diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/add-disk | 47 | ||||
-rwxr-xr-x | scripts/amuFormat.sh | 103 | ||||
-rwxr-xr-x | scripts/download | 81 | ||||
-rw-r--r-- | scripts/format.dat | 41 | ||||
-rwxr-xr-x | scripts/mcheck | 61 | ||||
-rwxr-xr-x | scripts/mcomp | 28 | ||||
-rwxr-xr-x | scripts/mxtar | 25 | ||||
-rwxr-xr-x | scripts/tgz | 86 | ||||
-rwxr-xr-x | scripts/uz | 92 |
9 files changed, 564 insertions, 0 deletions
diff --git a/scripts/add-disk b/scripts/add-disk new file mode 100755 index 0000000..3e14e58 --- /dev/null +++ b/scripts/add-disk @@ -0,0 +1,47 @@ +#!/bin/sh + +# Copyright 1997 Tim Hoogasian (hoogs@usa.net) +# Copyright 1997,1998,2001,2002 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. + +# +# add-disk +# Contributed by Tim Hoogasian (hoogs@usa.net) +# +# Runs the commands to make Solaris locate a new disk that +# has been plugged in after the system was booted. +# + +# This script can be used on a Solaris system to add a SCSI disk +# without needing to reboot/reconfigure the system. It's short and +# simple, but it's quite handy -- and it saves you from having to +# remember the individual commands.... :-) + +# You might also want to use the format.dat file if you don't have one +# yet. It is in this same mtools/scripts directory, and should be +# stored in /etc, or appended to the existing format.dat file + +# All you have to do is attach the Jaz drive, check to make sure there +# isn't SCSI address conflict (Zip and Jaz media tend to default to ID +# number 5) power it up, run "add-disk", insert the media, and GO! + + +/usr/sbin/drvconfig +/usr/sbin/devlinks +/usr/sbin/disks # or /usr/sbin/tapes for tapes +/usr/ucb/ucblinks # Compatibility links + +exit 0 diff --git a/scripts/amuFormat.sh b/scripts/amuFormat.sh new file mode 100755 index 0000000..c9ff469 --- /dev/null +++ b/scripts/amuFormat.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# Copyright 2004 Feuz Stefan. +# Copyright 2007 Adam Tkac. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. +# +# amuFormat.sh Formats various types and sizes of PC-Cards, according to the +# AMU-specification +# +# parameters: $1: Card Type: The Card Type is written as disk/volume-label +# to the boot-record +# The string should have a length of max. 11 characters. +# +# $2: Drive character (b:, c:) +# +# 10-12-2003 lct created +# +vers=1.4 + +#echo "debug: $0,$1,$2,$3,$4" + +# +# main() +# +if [ $# -ne 2 ] ; then + echo "Usage: amuFormat.sh <Card Type> <drive>" >&2 + echo "<Card Type> has to be defined in amuFormat.sh itself" >&2 + echo "<drive> has to be defined in mtools.conf" >&2 + exit 1 +fi + +echo "amuFormat $vers started..." + +drive="$2" + +case "$1" in +8MBCARD-FW) + ## using the f: or g: drive for fat12 formatting... + ## see mtools.conf file... + case "$2" in + [bB]:) drive="f:" ;; + [cC]:) drive="g:" ;; + *) echo "Drive $2 not supported."; exit 1 ;; + esac + cylinders=245 heads=2 cluster_size=8 + ;; +32MBCARD-FW) + #from amu_toolkit_0_6: + #mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 -N0000 c: + cylinders=489 heads=4 cluster_size=4 + ;; +64MBCARD-FW) + echo "***** WARNING: untested on AvHMU, exiting *****" + exit 1 + cylinders=245 heads=2 cluster_size=8 + ;; +1GBCARD-FW) + # from amu_toolkit_0_6: + #mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD -M512 -N 0000 c: + echo "***** WARNING: untested on AvHMU *****" + cylinders=2327 heads=16 cluster_size=64 + ;; +64MBCARDSAN) + # from amu_toolkit_0_6: + #mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD -M512 -N 0000 c: + cylinders=489 heads=8 cluster_size=4 + ;; +# +# insert new cards here... +# +*) + echo "Card not supported." + exit 1 + ;; +esac + +echo "Formatting card in slot $2 as $1" + +## initialise partition table +mpartition -I "$drive" + +# write a partition table +mpartition -c -t$cylinders -h$heads -s32 -b32 "$drive" + +## write boot-record, two FATs and a root-directory +mformat -c$cluster_size -v "$1" "$drive" + +minfo "$2" +mdir "$2" + +echo "done." diff --git a/scripts/download b/scripts/download new file mode 100755 index 0000000..142eb99 --- /dev/null +++ b/scripts/download @@ -0,0 +1,81 @@ +#!/bin/sh - + +# Copyright 1996 Carlos Duarte +# Copyright 1997,2001,2002 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. + + +## (c) Carlos Duarte ## Created: 18-Dec-96 ## Updated: 18-Dec-96 ## + +# main + +FAKE= +DRIVE=a +TOGGLE=0 +MDEL=: +while [ "$1" ] +do + case `echo z$1|cut -c2-` in + -n) FAKE=echo ;; + -d) DRIVE=`echo $1|cut -c3-` + [ "$DRIVE" = "" ] && { + shift + DRIVE=$1 + [ "$DRIVE" = "" ] && break + } ;; + -t) TOGGLE=1 ;; + -rm) MDEL=mdel ;; + *) break ;; + esac + shift +done + +if [ $# -ne 1 ] ; then + echo "usage: $0 [-n] [-d drive] [-rm] [-t] <ndisks>" + exit 1 +fi + +ndisks=$1 +n=0 +dir=1 + +while test $n -lt $ndisks +do + + while [ -d $dir ] + do + dir=`expr $dir + 1` + done + + $FAKE mkdir $dir + $FAKE mcopy $DRIVE:\* $dir && $FAKE $MDEL $DRIVE:\* + + if [ "$TOGGLE" = "1" ] ; then + if [ "$DRIVE" = "a" ] ; then + DRIVE=b + else + DRIVE=a + fi + else + echo Replace disk and press return + read ans + fi + + n=`expr $n + 1` + dir=`expr $dir + 1` +done + +exit 0 diff --git a/scripts/format.dat b/scripts/format.dat new file mode 100644 index 0000000..7fd31c1 --- /dev/null +++ b/scripts/format.dat @@ -0,0 +1,41 @@ +# Copyright 1997 Tim Hoogasian (hoogs@usa.net) +# Copyright 1997,2001,2002 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. +# +# /etc/format.dat file for Accessing ZIP and Jaz disks from Solaris +# +# Contributed by Tim Hoogasian (thoogasi@us.oracle.com) +# + +disk_type = "Iomega ZIP 100" \ + : ctlr = SCSI \ + : ncyl = 2406 : acyl = 2 : pcyl = 2408 : nhead = 2 \ + : nsect = 40 : rpm = 3600 : bpt = 20480 + +# Default Zip floppy part'n map : block 0-192480 (entire disk) +# +partition = "Iomega ZIP 100" \ + : disk = "Iomega ZIP 100" : ctlr = SCSI \ + : 2 = 0, 192480 +## +disk_type = "Jaz 1GB" \ + : ctlr = SCSI \ + : ncyl = 1018 : acyl = 2 : pcyl = 1020 : nhead = 64 \ + : nsect = 32 : rpm = 3600 : bpt = 16384 + +partition = "Jaz 1GB" \ + : disk = "Jaz 1GB" : ctlr = SCSI \ + : 2 = 0,2084864 diff --git a/scripts/mcheck b/scripts/mcheck new file mode 100755 index 0000000..f2c917f --- /dev/null +++ b/scripts/mcheck @@ -0,0 +1,61 @@ +#!/bin/sh +# Copyright 1994 David C. Niemi +# Copyright 1994,1997,2001,2002 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. +# +# mcheck [ <DOS drive letter> ] +# +# Read every file on an MS-DOS formatted disk to make sure they're good. +# +# Requires: mdir and mread utilities from mtools in user's path. +# +# 1994/02/19 DCN Created +# 1994/??/?? ALK Added case statement for results of mdir +# 1994/09/24 DCN Cleanup (5 minutes on top of the 30 seconds creating it) +# 1994/12/01 DCN Better comments, notices to stderr +# +# Copyright (C) 1994 David C. Niemi (niemi@tuxers.net) +# The author requires that any copies or derived works include this +# copyright notice; no other restrictions are placed on its use. +# + +set -e +set -u + +DRIVE=${1:-'A:'} +mdir ${DRIVE}'*' +case $? in +2) + echo "No files on disk." >&2 + exit 0 + ;; +1) + exit 1 + ;; +0) + ;; +esac + +echo >&2; echo "Verifying files on drive ${DRIVE}..." >&2 +if mtype -/ ${DRIVE}\* > /dev/null; then + echo "Disk in drive ${DRIVE} is OK." >&2 + exit 0 +else + echo "Disk in drive ${DRIVE} has errors." >&2 + exit 1 +fi + +## NOTREACHED ## diff --git a/scripts/mcomp b/scripts/mcomp new file mode 100755 index 0000000..f541eb8 --- /dev/null +++ b/scripts/mcomp @@ -0,0 +1,28 @@ +#!/bin/sh + +# Copyright 1996,1997,2001,2002,2006,2010 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. + +if [ $# -lt 2 ]; then + echo "usage: $0 dosfile [cmpoptions] unixfile" + exit 1 +fi + +dosfile=$1 +shift + +mcopy $dosfile - | cmp "$@" + diff --git a/scripts/mxtar b/scripts/mxtar new file mode 100755 index 0000000..49acc49 --- /dev/null +++ b/scripts/mxtar @@ -0,0 +1,25 @@ +#!/bin/sh + +# Copyright 1996,1997,2001,2002,2010 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. + +taropt=$1 +dosfile=$2 +shift +shift + +mcopy $dosfile - | tar $taropt - "$@" + diff --git a/scripts/tgz b/scripts/tgz new file mode 100755 index 0000000..8769ea6 --- /dev/null +++ b/scripts/tgz @@ -0,0 +1,86 @@ +#!/bin/sh +# Copyright 1994 David C. Niemi. +# Copyright 1997,2001,2002 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. +# +# tgz [destination [source...] ] +# +# Make a gzip'd tar archive $1 (or stdout) out of specified files +# (or, if not specified, from everything in the current directory) +# +# Requires gzip in the user's path. +# +# Requires gnu tar (or something close) in the user's path +# due to use of --exclude, --totals and -S. +# +# 1994/02/19 DCN Created +# 1994/12/01 DCN Cleanup and major improvements +# +# Copyright (C) 1994 David C. Niemi (niemi@tuxers.net) +# The author requires that any copies or derived works include this +# copyright notice; no other restrictions are placed on its use. +# + +set -e +set -u + +Error () +{ echo "Error: $0: ${@-}." >&2 + exit 1 +} + +if [ $# = 0 ]; then + dest= + src=. + tar cvf - . | gzip -9v + exit 0 +elif [ $# = 1 ]; then + dest=$1 + src=. +else + dest=$1 + shift + src="${@-}" +fi + +case $dest in +"" | . | .. | */ | */. | */.. ) + echo "Usage: $0: [destination [source...] ]" >&2 + exit 1 + ;; +*.t?z | *.?z | *.z | *.Z | *.tz | *.tz? ) + ;; +*) + dest=${dest}.tgz ## Add on .tgz as default suffix +esac + +if [ -h "$dest" ]; then + Error "Destination file \"$dest\" already exists as a symbolic link" +elif [ -f "$dest" ]; then + Error "Destination \"$dest\" already exists as a file" +elif [ -d "$dest" ]; then + Error "Destination \"$dest\" already exists as a directory" +fi +if [ -z "$dest" -o "X$dest" = 'X-' ]; then + echo "Writing gzipp'd tar archive to standard output." >&2 + tar cvfS - -- $src | gzip -9v +else + echo "Writing gzip'd tar archive to \"$dest\"." >&2 + tar -cvS --totals --exclude "$dest" -f - -- $src | gzip -9v > "$dest" + ls -l "$dest" >&2 +fi + +exit 0 diff --git a/scripts/uz b/scripts/uz new file mode 100755 index 0000000..3594130 --- /dev/null +++ b/scripts/uz @@ -0,0 +1,92 @@ +#!/bin/sh +# Copyright 1994,2002 David C. Niemi. +# Copyright 1996,1997,2001-2003,2010 Alain Knaff. +# This file is part of mtools. +# +# Mtools is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mtools is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mtools. If not, see <http://www.gnu.org/licenses/>. +# uz [file...] +# lz [file...] +# +# If called "uz", gunzips and extracts a gzip'd tar'd archive. +# If called "lz", gunzips and shows a listing of a gzip'd tar'd archive. +# +# Requires: gzip and tar in the user's path. Should work with most tars. +# "-" is now used for backwards compatibility with antique tars, e.g. SCO. +# +# 1994/02/19 DCN Created (as a trivial, but useful script) +# 1994/12/01 DCN Combined uz and lz, added suffix handling +# 2002/09/11 DCN Added bzip2 support +# 2010/10/16 AKN Added lzip support +# +# Copyright (C) 1994, 2002 David C. Niemi (niemi at tuxers dot net) +# The author requires that any copies or derived works include this +# copyright notice; no other restrictions are placed on its use. +# + +set -e +set -u + +## Default unzipping command +uzcmd='gzip -cd' + +case $0 in +*uz) + tarparam="-pxvf" + action="Extracting from " + ;; +*lz) + tarparam="-tvf" + action="Reading directory of " + ;; +*) + echo "$0: expect to be named either \"uz\" or \"lz\"." >&2 + exit 1 + ;; +esac + +if [ $# = 0 ]; then + echo "$action standard input." >&2 + $uzcmd - | tar "$tarparam" - + exit 0 +fi + +while [ $# -ge 1 ]; do + echo >&2 + found= + + for suffix in "" .gz .tgz .tar.gz .z .tar.z .taz .tpz .Z .tar.Z .tar.bz2 tar.lz ; do + if [ -r "${1}$suffix" ]; then + found=$1$suffix + break + fi + done + + case $found in + *.tar.bz2 | *.tb2) + uzcmd='bzip2 -cd' + ;; + *.tar.lz) + uzcmd='lzip -cd' + ;; + esac + if [ -z "$found" ]; then + echo "$0: could not read \"$1\"." >&2 + else + echo "$action \"$found\"." >&2 + $uzcmd -- "$found" | tar "$tarparam" - + fi + shift +done + +exit 0 |