Init
This commit is contained in:
31
cmd/osadmin/shell/Makefile
Executable file
31
cmd/osadmin/shell/Makefile
Executable file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
#ident "@(#)Makefile 1.8 92/12/15 SMI"
|
||||
#
|
||||
# Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
#
|
||||
# cmd/osadmin/shell/Makefile
|
||||
#
|
||||
|
||||
include ../../Makefile.cmd
|
||||
include ../Makefile.include
|
||||
|
||||
#SHFILES = admerr agefile diskumount drivename labelfsname samedev
|
||||
SHFILES = agefile
|
||||
ROOTSHFILES = $(SHFILES:%=$(ROOTLIB)/%)
|
||||
CLOBBERFILES = "Nothing to clobber"
|
||||
|
||||
.KEEP_STATE:
|
||||
|
||||
all: $(SHFILES)
|
||||
|
||||
install: all $(ROOTSHFILES)
|
||||
|
||||
# Don't install a directory already installed by Targetdirs
|
||||
#$(ROOTLIB):
|
||||
# $(INS.dir)
|
||||
|
||||
clean:
|
||||
|
||||
lint:
|
||||
|
||||
include ../../Makefile.targ
|
||||
24
cmd/osadmin/shell/admerr
Executable file
24
cmd/osadmin/shell/admerr
Executable file
@@ -0,0 +1,24 @@
|
||||
#ident "@(#)admerr 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# Issue a standard error message for an administrative command.
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo >&2 "Usage: $0 command-name message ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $0 in
|
||||
*/admerr | admerr )
|
||||
type='ADMIN COMMAND'
|
||||
;;
|
||||
* )
|
||||
type=SOFTWARE
|
||||
esac
|
||||
|
||||
cmd=$1
|
||||
shift
|
||||
echo >&2 "
|
||||
${type} ERROR: Call Customer Service.
|
||||
${cmd}: $*\\n"
|
||||
151
cmd/osadmin/shell/agefile
Executable file
151
cmd/osadmin/shell/agefile
Executable file
@@ -0,0 +1,151 @@
|
||||
#ident "@(#)agefile 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# age files by moving to older and older names (agefile)
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
cmd=$0
|
||||
defaultcycles=4
|
||||
header=
|
||||
pack=
|
||||
|
||||
{ exitcode_=0
|
||||
while getopts c:fhp c
|
||||
do
|
||||
case $c in
|
||||
\?)
|
||||
exitcode_=1
|
||||
break;;
|
||||
*) if [ "$OPTARG" ]
|
||||
then
|
||||
arg="$arg -$c '$OPTARG'"
|
||||
else
|
||||
arg="$arg -$c"
|
||||
fi;;
|
||||
esac
|
||||
done
|
||||
shift `expr $OPTIND - 1`
|
||||
arg="$arg --"
|
||||
for i in "$@"
|
||||
do
|
||||
arg="$arg '$i'"
|
||||
done
|
||||
eval set -- "$arg"
|
||||
test $exitcode_ = 0 ;} || exec ${cmd}
|
||||
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
case $1 in
|
||||
-c )
|
||||
shift
|
||||
defaultcycles=$1
|
||||
shift
|
||||
;;
|
||||
-f ) # Take arguments from file name.
|
||||
# Lines that start with # are comments.
|
||||
shift
|
||||
shift # get rid of -- introduced by getopt
|
||||
cat $* | grep -v '^#' |
|
||||
xargs ${cmd} -c${defaultcycles} ${headflag} ${packflag} --
|
||||
exit
|
||||
;;
|
||||
-h )
|
||||
header=all
|
||||
headflag=$1
|
||||
shift
|
||||
;;
|
||||
-p )
|
||||
pack=all
|
||||
packflag=$1
|
||||
shift
|
||||
;;
|
||||
-- )
|
||||
shift
|
||||
break
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# = 0 ]
|
||||
then
|
||||
echo >&2 "Usage: ${cmd} [ -c <cycles> ] [ -p ] [ -h ] file ...
|
||||
${cmd} [ -c <cycles> ] [ -p ] [ -h ] -f file ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umask 000
|
||||
for file
|
||||
do
|
||||
if [ -n "${headflag}" ]
|
||||
then
|
||||
header=yes
|
||||
fi
|
||||
if [ -n "${packflag}" ]
|
||||
then
|
||||
pack=.z
|
||||
fi
|
||||
case ${file} in
|
||||
-c[0-9]* )
|
||||
nextcycle=`expr ${file} : '-c\(.*\)'`
|
||||
continue
|
||||
;;
|
||||
-p )
|
||||
pack=.z
|
||||
continue
|
||||
;;
|
||||
-h )
|
||||
header=yes
|
||||
continue
|
||||
esac
|
||||
if [ -n "${nextcycle}" ]
|
||||
then
|
||||
cycles=${nextcycle}
|
||||
lastcycle=${nextcycle}
|
||||
nextcycle=
|
||||
else
|
||||
cycles=${defaultcycles}
|
||||
lastcycle=${defaultcycles}
|
||||
fi
|
||||
|
||||
if [ ! -f ${file} ]
|
||||
then
|
||||
echo >&2 "${cmd}: No file '${file}'"
|
||||
continue
|
||||
fi
|
||||
|
||||
basename=`basename ${file}`
|
||||
while [ ${cycles} -gt 1 ]
|
||||
do
|
||||
prev=`expr ${cycles} - 1`
|
||||
if [ `expr ${basename}-${cycles}${pack} : '.*'` -gt 14 ]
|
||||
then
|
||||
echo >&2 "${cmd}: filename too long '${file}-${cycles}${pack}'"
|
||||
cycles=${prev}
|
||||
continue
|
||||
fi
|
||||
if [ ${cycles} = ${lastcycle} ]
|
||||
then
|
||||
rm -f ${file}-${cycles} ${file}-${cycles}.z
|
||||
fi
|
||||
if [ -f ${file}-${prev}.z ]
|
||||
then
|
||||
mv -f ${file}-${prev}.z ${file}-${cycles}.z
|
||||
elif [ -f ${file}-${prev} ]
|
||||
then
|
||||
mv -f ${file}-${prev} ${file}-${cycles}
|
||||
fi
|
||||
cycles=${prev}
|
||||
done
|
||||
mv -f ${file} ${file}-1
|
||||
|
||||
if [ -n "${pack}" ]
|
||||
then
|
||||
pack ${file}-1 >/dev/null 2>&1
|
||||
pack=
|
||||
fi
|
||||
|
||||
>> ${file}
|
||||
if [ ${header} ]
|
||||
then
|
||||
(date; echo ============================) >> ${file}
|
||||
header=
|
||||
fi
|
||||
done
|
||||
37
cmd/osadmin/shell/diskumount
Executable file
37
cmd/osadmin/shell/diskumount
Executable file
@@ -0,0 +1,37 @@
|
||||
#ident "@(#)diskumount 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# perform a umount, complain if it doesn't work
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
# $1 == the device mounted.
|
||||
# $2 == the mount point directory (optional).
|
||||
|
||||
ndrive='drive'
|
||||
|
||||
case "$1" in
|
||||
-n )
|
||||
ndrive=$2
|
||||
shift
|
||||
shift
|
||||
esac
|
||||
|
||||
msg=`/etc/umount ${1:?} 2>&1`
|
||||
case "${msg}" in
|
||||
'' )
|
||||
echo >&2 $2 ${2:+'unmounted. '} \
|
||||
"You may now remove the medium from the ${ndrive}.\n"
|
||||
;;
|
||||
*' busy' )
|
||||
echo >&2 "
|
||||
The file system is \"busy\" which means that either some command
|
||||
is using files under ${2:-it} or someone is logged in and currently
|
||||
in a directory within the file system."
|
||||
exit 1
|
||||
;;
|
||||
*' not mounted' )
|
||||
;;
|
||||
* )
|
||||
admerr $0 "/etc/umount got '${msg}'"
|
||||
exit 1
|
||||
esac
|
||||
exit 0
|
||||
6
cmd/osadmin/shell/drivename
Executable file
6
cmd/osadmin/shell/drivename
Executable file
@@ -0,0 +1,6 @@
|
||||
#ident "@(#)drivename 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# Derive a device name from its path name.
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
echo `basename ${1:?}` drive
|
||||
14
cmd/osadmin/shell/labelfsname
Executable file
14
cmd/osadmin/shell/labelfsname
Executable file
@@ -0,0 +1,14 @@
|
||||
#ident "@(#)labelfsname 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# given the output of /etc/labelit, return the file system name and
|
||||
# volume label as shell variable assignments.
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo >&2 "Usage: $0 /etc/labelit-output"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $* |
|
||||
sed -n 's/Current fsname: \(.*\), Current volname: \(.*\), Blocks: .*/fsname=\1 label=\2/p'
|
||||
45
cmd/osadmin/shell/samedev
Executable file
45
cmd/osadmin/shell/samedev
Executable file
@@ -0,0 +1,45 @@
|
||||
#ident "@(#)samedev 1.3 92/07/14 SMI" /* SVr4.0 1.1 */
|
||||
# Determine if any of the check_dev's are identical to the known_dev
|
||||
# by comparing their block or character special file major/minor numbers.
|
||||
|
||||
#! chmod +x ${file}
|
||||
|
||||
set -ue
|
||||
|
||||
IFS="${IFS},"
|
||||
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo "Usage: ${0} known_dev check_dev ..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval `ls -l ${1} | \
|
||||
(read perm links uid gid major minor month day when name ; \
|
||||
echo perm=${perm} want=${major}/${minor})`
|
||||
|
||||
case "${perm}" in
|
||||
b*)
|
||||
type=b
|
||||
;;
|
||||
c*)
|
||||
type=c
|
||||
;;
|
||||
*)
|
||||
echo "${0}: ${1}: Not a block or character device" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
|
||||
ls -ld "$@" | while read perm links uid gid major minor month day when name
|
||||
do
|
||||
case ${perm} in
|
||||
${type}* )
|
||||
if [ "${major}/${minor}" = "${want}" ]
|
||||
then
|
||||
echo "${name}"
|
||||
fi
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user