diff options
40 files changed, 436 insertions, 436 deletions
diff --git a/init.d/adjkerntz.in b/init.d/adjkerntz.in index cf8c1fa8..9f17212c 100644 --- a/init.d/adjkerntz.in +++ b/init.d/adjkerntz.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. extra_commands="save" @@ -7,8 +7,8 @@ extra_commands="save" description="Sets the local clock to UTC or Local Time." description_save="Saves the current time in the BIOS." -clock=${clock:-${CLOCK:-UTC}} -if [ "${clock}" = "UTC" ]; then +: ${clock:=${CLOCK:-UTC}} +if [ "$clock" = "UTC" ]; then utc="UTC" else utc="Local Time" @@ -18,8 +18,8 @@ depend() { provide clock # BSD adjkerntz needs to be able to write to /etc - if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] || - [ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then + if [ "$clock" = "UTC" -a -e /etc/wall_cmos_clock ] || + [ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then need root fi keyword nojail noprefix @@ -28,7 +28,7 @@ depend() start() { ebegin "Starting the System Clock Adjuster [${utc}]" - if [ "${clock}" != "UTC" ]; then + if [ "$clock" != "UTC" ]; then echo >/etc/wall_cmos_clock start-stop-daemon --start --exec /sbin/adjkerntz -- -i else @@ -48,8 +48,8 @@ save() stop() { # Don't tweak the hardware clock on LiveCD halt. - if yesno "${clock_systohc:-${CLOCK_SYSTOHC}}"; then - [ -z "${CDBOOT}" ] && save + if yesno "${clock_systohc:-$CLOCK_SYSTOHC}"; then + [ -z "$CDBOOT" ] && save fi ebegin "Stopping the System Clock Adjuster" diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index 496f0464..d1119ad3 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -16,25 +16,27 @@ dir_writeable() mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ } +: ${wipe_tmp:=${WIPE_TMP:-yes}} + cleanup_tmp_dir() { local dir="$1" - if ! [ -d "${dir}" ]; then - mkdir -p "${dir}" || return $? + if ! [ -d "$dir" ]; then + mkdir -p "$dir" || return $? fi - dir_writeable "${dir}" || return 1 - chmod +t "${dir}" - cd "${dir}" - if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then - ebegin "Wiping ${dir} directory" + dir_writeable "$dir" || return 1 + chmod +t "$dir" + cd "$dir" + if yesno $wipe_tmp; then + ebegin "Wiping $dir directory" local startopts="-x . -depth" - [ "${RC_UNAME}" = Linux ] && startopts=". -xdev -depth" + [ "$RC_UNAME" = Linux ] && startopts=". -xdev -depth" # Faster than find rm -rf -- [^ajlq\.]* - find ${startopts} ! -name . \ + find $startopts ! -name . \ ! -path "./lost+found" \ ! -path "./lost+found/*" \ ! -path "./quota.user" \ @@ -52,11 +54,11 @@ cleanup_tmp_dir() -exec rm -rf {} \; eend 0 else - ebegin "Cleaning ${dir} directory" - rm -rf -- "${dir}"/.X*-lock "${dir}"/esrv* "${dir}"/kio* \ - "${dir}"/jpsock.* "${dir}"/.fam* "${dir}"/.esd* \ - "${dir}"/orbit-* "${dir}"/ssh-* "${dir}"/ksocket-* \ - "${dir}"/.*-unix + ebegin "Cleaning $dir directory" + rm -rf -- "$dir"/.X*-lock "$dir"/esrv* "$dir"/kio* \ + "$dir"/jpsock.* "$dir"/.fam* "$dir"/.esd* \ + "$dir"/orbit-* "$dir"/ssh-* "$dir"/ksocket-* \ + "$dir"/.*-unix eend 0 fi } @@ -71,12 +73,15 @@ mkutmp() start() { + # Remove any added console dirs + rm -rf "$RC_LIBDIR"/console + local logw=false runw=false # Ensure that our basic dirs exist for x in /var/log /var/run /tmp; do - if ! [ -d "${x}" ]; then - if ! mkdir -p "${x}"; then - eend 1 "failed to create needed directory ${x}" + if ! [ -d $x ]; then + if ! mkdir -p $x; then + eend 1 "failed to create needed directory $x" return 1 fi fi @@ -85,9 +90,9 @@ start() if dir_writeable /var/run; then ebegin "Creating user login records" local xtra= - [ "${RC_UNAME}" = NetBSD ] && xtra=x + [ "$RC_UNAME" = NetBSD ] && xtra=x for x in "" $xtra; do - mkutmp /var/run/utmp${x} + mkutmp /var/run/utmp$x done [ -e /var/log/wtmp ] && mkutmp /var/log/wtmp eend 0 @@ -98,22 +103,22 @@ start() ! -name ld-elf.so.hints ! -name ld.so.hints); do # Clean stale sockets - if [ -S "${x}" ]; then + if [ -S "$x" ]; then if type fuser >/dev/null 2>&1; then - fuser "${x}" 2>/dev/null || rm "${x}" + fuser "$x" 2>/dev/null || rm -- "$x" else - rm "${x}" + rm -- "$x" fi fi - [ ! -f "${x}" ] && continue + [ ! -f "$x" ] && continue # Do not remove pidfiles of already running daemons - case "${x}" in + case "$x" in *.pid) start-stop-daemon --test --quiet \ - --stop --pidfile "${x}" && continue + --stop --pidfile "$x" && continue ;; esac - rm -f -- "${x}" + rm -f -- "$x" done eend 0 fi @@ -121,7 +126,7 @@ start() # Clean up /tmp directories local tmp= for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do - cleanup_tmp_dir "${tmp}" + cleanup_tmp_dir "$tmp" done if dir_writeable /tmp; then @@ -131,12 +136,14 @@ start() rm -rf /tmp/.ICE-unix /tmp/.X11-unix mkdir -p /tmp/.ICE-unix /tmp/.X11-unix chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix - [ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix + if [ -x /sbin/restorecon ]; then + restorecon /tmp/.ICE-unix /tmp/.X11-unix + fi fi - if ${logw} || dir_writeable /var/log; then + if $logw || dir_writeable /var/log; then # Create an 'after-boot' dmesg log - if [ "${RC_SYS}" != VSERVER -a "${RC_SYS}" != OPENVZ ]; then + if [ "$RC_SYS" != VSERVER -a "$RC_SYS" != OPENVZ ]; then dmesg > /var/log/dmesg chmod 640 /var/log/dmesg fi @@ -149,10 +156,10 @@ start() stop() { # Write a halt record if we're shutting down - if [ "${RC_RUNLEVEL}" = shutdown ]; then - [ "${RC_UNAME}" = Linux ] && halt -w - if [ "${RC_SYS}" = OPENVZ ]; then - yesno ${RC_REBOOT} && printf "" >/reboot + if [ "$RC_RUNLEVEL" = shutdown ]; then + [ "$RC_UNAME" = Linux ] && halt -w + if [ "$RC_SYS" = OPENVZ ]; then + yesno $RC_REBOOT && printf "" >/reboot fi fi diff --git a/init.d/consolefont.in b/init.d/consolefont.in index 2cc10aea..8c6be7d1 100644 --- a/init.d/consolefont.in +++ b/init.d/consolefont.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Sets a font for the consoles." @@ -7,27 +7,24 @@ description="Sets a font for the consoles." depend() { need localmount termencoding - after hotplug + after hotplug bootmisc keyword noopenvz noprefix nouml novserver noxenu } start() { - # Forget about any font until we are successful - rm -rf "${RC_LIBDIR}"/console - ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} consolefont=${consolefont:-${CONSOLEFONT}} unicodemap=${unicodemap:-${UNICODEMAP}} consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}} - if [ -z "${consolefont}" ]; then + if [ -z "$consolefont" ]; then ebegin "Using the default console font" eend 0 return 0 fi - if [ "${ttyn}" = 0 ]; then + if [ "$ttyn" = 0 ]; then ebegin "Skipping font setup (rc_tty_number == 0)" eend 0 return 0 @@ -36,39 +33,39 @@ start() local x= param= sf_param= retval=0 ttydev=/dev/tty # Get additional parameters - if [ -n "${consoletranslation}" ]; then - param="${param} -m ${consoletranslation}" + if [ -n "$consoletranslation" ]; then + param="$param -m $consoletranslation" fi if [ -n "${unicodemap}" ]; then - param="${param} -u ${unicodemap}" + param="$param -u $unicodemap" fi # Set the console font - ebegin "Setting console font [${consolefont}]" + ebegin "Setting console font [$consolefont]" [ -d /dev/vc ] && ttydev=/dev/vc/ x=1 - while [ ${x} -le ${ttyn} ]; do - setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null - retval=$((${retval} + $?)) - x=$((${x} + 1)) + while [ $x -le $ttyn ]; do + setfont $consolefont $param -C $ttydev$x >/dev/null + retval=$(($retval + $?)) + x=$(($x + 1)) done - eend ${retval} + eend $retval # Store the last font so we can use it ASAP on boot - if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then - mkdir -p "${RC_LIBDIR}"/console - for font in /usr/share/consolefonts/"${consolefont}".*; do + if [ $retval -eq 0 -a -w "$RC_LIBDIR" ]; then + mkdir -p "$RC_LIBDIR"/console + for font in /usr/share/consolefonts/"$consolefont".*; do : done - cp "${font}" "${RC_LIBDIR}"/console - echo "${font##*/}" > "${RC_LIBDIR}"/console/font + cp "$font" "$RC_LIBDIR"/console + echo "${font##*/}" >"$RC_LIBDIR"/console/font if yesno ${unicode:-${UNICODE}}; then - echo "" > "${RC_LIBDIR}"/console/unicode + echo "" > "$RC_LIBDIR"/console/unicode else - rm -f "${RC_LIBDIR}"/console/unicode + rm -f "$RC_LIBDIR"/console/unicode fi fi - return ${retval} + return $retval } diff --git a/init.d/devd.in b/init.d/devd.in index 039aa961..fd40e3cf 100644 --- a/init.d/devd.in +++ b/init.d/devd.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=/sbin/devd -command_args=${devd_args} +command_args=$devd_args name="Device State Change Daemon" depend() { diff --git a/init.d/devfs.in b/init.d/devfs.in index 84f3575a..4c92b2c1 100644 --- a/init.d/devfs.in +++ b/init.d/devfs.in @@ -15,19 +15,19 @@ start() { "devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \ "tmpfs /dev/shm 1777 ,nodev shm" \ ; do - set -- ${x} + set -- $x grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue - mountinfo -q "$2" && continue + mountinfo -q $2 && continue - if [ ! -d "$2" ]; then - mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \ + if [ ! -d $2 ]; then + mkdir -m $3 -p $2 >/dev/null 2>&1 || \ ewarn "Could not create $2!" fi - if [ -d "$2" ]; then + if [ -d $2 ]; then ebegin "Mounting $2" - if ! fstabinfo --mount "$2"; then - mount -n -t "$1" -o noexec,nosuid"$4" "$5" "$2" + if ! fstabinfo --mount $2; then + mount -n -t $1 -o noexec,nosuid$4 $5 $2 fi eend $? fi diff --git a/init.d/dmesg.in b/init.d/dmesg.in index d3528d0d..f7b7f21b 100644 --- a/init.d/dmesg.in +++ b/init.d/dmesg.in @@ -12,7 +12,7 @@ depend() start() { - if [ -n "${dmesg_level}" ]; then - dmesg -n"${dmesg_level}" + if [ -n "$dmesg_level" ]; then + dmesg -n$dmesg_level fi } diff --git a/init.d/dumpon.in b/init.d/dumpon.in index f2b65308..26179d82 100644 --- a/init.d/dumpon.in +++ b/init.d/dumpon.in @@ -11,8 +11,8 @@ depend() { start() { # Setup any user requested dump device - if [ -n "${dump_device}" ]; then - ebegin "Activating kernel core dump device (${dump_device})" + if [ -n "$dump_device" ]; then + ebegin "Activating kernel core dump device ($dump_device)" dumpon ${dump_device} eend $? fi diff --git a/init.d/fsck.in b/init.d/fsck.in index d8e10c7c..cf1e8d6f 100644 --- a/init.d/fsck.in +++ b/init.d/fsck.in @@ -19,7 +19,7 @@ _abort() { # We should only reboot when first booting _reboot() { - if [ "${RC_RUNLEVEL}" = "${RC_BOOTLEVEL}" ]; then + if [ "$RC_RUNLEVEL" = "$RC_BOOTLEVEL" ]; then reboot "$@" _abort || return 1 fi @@ -39,40 +39,40 @@ start() return 0 fi if _forcefsck; then - fsck_opts="${fsck_opts} -f" + fsck_opts="$fsck_opts -f" check_extra="(check forced)" fi - if [ -n "${fsck_passno}" ]; then - check_extra="[passno ${fsck_passno}] ${check_extra}" + if [ -n "$fsck_passno" ]; then + check_extra="[passno $fsck_passno] $check_extra" fi - ebegin "Checking local filesystems ${check_extra}" - for p in ${fsck_passno}; do - local IFS="${_IFS}" - case "${p}" in - [0-9]*) p="=${p}";; + ebegin "Checking local filesystems $check_extra" + for p in $fsck_passno; do + local IFS="$_IFS" + case "$p" in + [0-9]*) p="=$p";; esac - set -- "$@" $(fstabinfo --passno "${p}") + set -- "$@" $(fstabinfo --passno "$p") unset IFS done - if [ "${RC_UNAME}" = "Linux" ]; then - fsck_opts="${fsck_opts} -C0 -T" - if [ -z "${fsck_passno}" ]; then + if [ "$RC_UNAME" = Linux ]; then + fsck_opts="$fsck_opts -C0 -T" + if [ -z "$fsck_passno" ]; then fsck_args=${fsck_args--A -p} if echo 2>/dev/null >/.test.$$; then rm -f /.test.$$ - fsck_opts="${fsck_opts} -R" + fsck_opts="$fsck_opts -R" fi fi fi trap : INT QUIT - fsck ${fsck_args--p} ${fsck_opts} "$@" + fsck ${fsck_args--p} $fsck_opts "$@" case $? in 0) eend 0; return 0;; 1) ewend 1 "Filesystems repaired"; return 0;; - 2|3) if [ "${RC_UNAME}" = "Linux" ]; then + 2|3) if [ "$RC_UNAME" = Linux ]; then ewend 1 "Filesystems repaired, but reboot needed" _reboot -f else @@ -80,7 +80,7 @@ start() "manual fsck required" _abort fi;; - 4) if [ "${RC_UNAME}" = "Linux" ]; then + 4) if [ "$RC_UNAME" = Linux ]; then ewend 1 "Fileystem errors left uncorrected, aborting" _abort else @@ -101,6 +101,6 @@ stop() _reboot() { return 0; } _forcefsck() { return 1; } - yesno "${fsck_shutdown}" && start + yesno $fsck_shutdown && start return 0 } diff --git a/init.d/hostid.in b/init.d/hostid.in index 00df273d..46c76818 100644 --- a/init.d/hostid.in +++ b/init.d/hostid.in @@ -1,9 +1,9 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. extra_commands="reset" -hostid_file=${hostid_file:-/etc/hostid} +: ${hostid_file:=/etc/hostid} depend() { @@ -20,14 +20,14 @@ _set() id=$(echo "$1" | md5) id="0x${id%????????????????????????}" fi - ebegin "Setting Host ID: ${id}" - sysctl -w kern.hostid="${id}" >/dev/null + ebegin "Setting Host ID: $id" + sysctl -w kern.hostid="$id" >/dev/null eend $? || return 1 if sysctl -n kern.hostuuid >/dev/null 2>&1; then [ -n "$1" ] && id=$1 - ebegin "Setting Host UUID: ${id}" - sysctl kern.hostuuid="${id}" >/dev/null + ebegin "Setting Host UUID: $id" + sysctl kern.hostuuid="$id" >/dev/null eend $? || return 1 fi @@ -38,37 +38,37 @@ _set() # otherwise we generate a random UUID. reset() { - local uuid= x="[0-9a-f]" y="${x}${x}${x}${x}" + local uuid= x="[0-9a-f]" y="$x$x$x$x" if type kenv >/dev/null 2>&1; then uuid=$(kenv smbios.system.uuid 2>/dev/null) fi - case "${uuid}" in - ${y}${y}-${y}-${y}-${y}-${y}${y}${y});; + case "$uuid" in + $y$y-$y-$y-$y-$y$y$y);; *) uuid=;; esac - if [ -n "${uuid}" ]; then - rm -f "${hostid_file}" + if [ -n "$uuid" ]; then + rm -f "$hostid_file" else uuid=$(uuidgen) - if [ -z "${uuid}" ]; then + if [ -z "$uuid" ]; then eerror "Unable to generate a UUID" return 1 fi - if ! echo "${uuid}" > "${hostid_file}"; then - eerror "Failed to store UUID in \`${hostid_file}'" + if ! echo "$uuid" >"$hostid_file"; then + eerror "Failed to store UUID in \`$hostid_file'" return 1 fi fi - _set "${uuid}" + _set "$uuid" } start() { - if [ -r "${hostid_file}" ]; then - _set $(cat "${hostid_file}") + if [ -r "$hostid_file" ]; then + _set $(cat "$hostid_file") else reset fi diff --git a/init.d/hostname.in b/init.d/hostname.in index 6266fe9e..8466915b 100644 --- a/init.d/hostname.in +++ b/init.d/hostname.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Sets the hostname of the machine." @@ -11,7 +11,7 @@ depend() { start() { hostname=${hostname-${HOSTNAME-localhost}} - ebegin "Setting hostname to ${hostname}" - hostname "${hostname}" + ebegin "Setting hostname to $hostname" + hostname "$hostname" eend $? "Failed to set the hostname" } diff --git a/init.d/hwclock.in b/init.d/hwclock.in index 424be2fe..5262a116 100644 --- a/init.d/hwclock.in +++ b/init.d/hwclock.in @@ -8,12 +8,11 @@ description="Sets the local clock to UTC or Local Time." description_save="Saves the current time in the BIOS." description_show="Displays the current time in the BIOS." -clock_adjfile=${clock_adjfile:-${CLOCK_ADJFILE}} -clock_args=${clock_args:-${CLOCK_OPTS}} -clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}} - -clock=${clock:-${CLOCK:-UTC}} -if [ "${clock}" = "UTC" ]; then +: ${clock_adjfile:=${CLOCK_ADJFILE}} +: ${clock_args:=${CLOCK_OPTS}} +: ${clock_systohc:=${CLOCK_SYSTOHC}} +: ${clock:=${CLOCK:-UTC}} +if [ "$clock" = "UTC" ]; then utc="UTC" utc_cmd="--utc" else @@ -24,7 +23,7 @@ fi depend() { provide clock - if yesno ${clock_adjfile}; then + if yesno $clock_adjfile; then use root else before * @@ -47,7 +46,7 @@ setupopts() ;; esac - case "${utc}" in + case "$utc" in UTC|Local" "Time);; *) unset utc_cmd;; esac @@ -58,7 +57,7 @@ _hwclock() { local err="$(hwclock "$@" 2>&1 >/dev/null)" - [ -z "${err}" ] && return 0 + [ -z "$err" ] && return 0 echo "${err}" >&2 return 1 } @@ -68,38 +67,38 @@ start() local retval=0 errstr="" setupopts - if [ -z "${utc_cmd}" ]; then - ewarn "Not setting clock for ${utc} system" + if [ -z "$utc_cmd" ]; then + ewarn "Not setting clock for $utc system" return 0 fi - ebegin "Setting system clock using the hardware clock [${utc}]" + ebegin "Setting system clock using the hardware clock [$utc]" if [ -e /proc/modules ]; then local rtc= for rtc in /dev/rtc /dev/rtc[0-9]*; do - [ -e "${rtc}" ] && break + [ -e "$rtc" ] && break done if [ ! -e "${rtc}" ]; then modprobe -q rtc-cmos || modprobe -q rtc || modprobe -q genrtc fi fi - if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then - _hwclock --adjust ${utc_cmd} - retval=$((${retval} + $?)) + if [ -e /etc/adjtime ] && yesno $clock_adjfile; then + _hwclock --adjust $utc_cmd + retval=$(($retval + $?)) fi # If setting UTC, don't bother to run hwclock when first booting # as that's the default - if [ "${PREVLEVEL}" != "N" -o \ - "${utc_cmd}" != "--utc" -o \ - -n "${clock_args}" ]; + if [ "$PREVLEVEL" != N -o \ + "$utc_cmd}" != --utc -o \ + -n "$clock_args" ]; then - _hwclock --hctosys ${utc_cmd} ${clock_args} - retval=$((${retval} + $?)) + _hwclock --hctosys $utc_cmd $clock_args + retval=$(($retval + $?)) fi - eend ${retval} "Failed to set the system clock" + eend $retval "Failed to set the system clock" return 0 } @@ -107,37 +106,37 @@ start() stop() { # Don't tweak the hardware clock on LiveCD halt. - [ -n "${CDBOOT}" ] && return 0 - yesno ${clock_systohc} || return 0 + [ -n "$CDBOOT" ] && return 0 + yesno $clock_systohc || return 0 local retval=0 errstr="" setupopts - [ -z "${utc_cmd}" ] && return 0 + [ -z "$utc_cmd" ] && return 0 - ebegin "Setting hardware clock using the system clock" "[${utc}]" + ebegin "Setting hardware clock using the system clock" "[$utc]" - if ! yesno "${clock_adjfile}"; then + if ! yesno $clock_adjfile; then # Some implementations don't handle adjustments if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then - utc_cmd="${utc_cmd} --noadjfile" + utc_cmd="$utc_cmd --noadjfile" fi fi - _hwclock --systohc ${utc_cmd} ${clock_args} + _hwclock --systohc $utc_cmd $clock_args retval=$? - eend ${retval} "Failed to sync clocks" + eend $retval "Failed to sync clocks" } save() { - clock_systohc="yes" + clock_systohc=yes stop } show() { setupopts - hwclock --show "${utc_cmd}" ${clock_args} + hwclock --show "$utc_cmd" $clock_args } diff --git a/init.d/ipfw.in b/init.d/ipfw.in index 61ac29e8..6452a7eb 100644 --- a/init.d/ipfw.in +++ b/init.d/ipfw.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. # This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD @@ -95,24 +95,24 @@ start() { # Add permits for this workstations published services below # Only IPs and nets in firewall_allowservices is allowed in. - for i in ${ipfw_ip_in}; do - for p in ${ipfw_ports_in}; do - ipfw add pass tcp from ${i} to me ${p} + for i in $ipfw_ip_in; do + for p in $ipfw_ports_in; do + ipfw add pass tcp from $i to me $p done done # Allow all connections from trusted IPs. # Playing with the content of firewall_trusted could seriously # degrade the level of protection provided by the firewall. - for i in ${ipfw_ip_trust}; do - ipfw add pass ip from ${i} to me + for i in $ipfw_ip_trust; do + ipfw add pass ip from $i to me done ipfw add 65000 count ip from any to any # Drop packets to ports where we don't want logging - for p in ${ipfw_ports_nolog}; do - ipfw add deny { tcp or udp } from any to any ${p} in + for p in $ipfw_ports_nolog; do + ipfw add deny { tcp or udp } from any to any $p in done # Broadcasts and muticasts @@ -129,10 +129,10 @@ start() { # Deny and (if wanted) log the rest unconditionally. if yesno ${ipfw_log_deny:-no}; then - log="log" + log=log sysctl net.inet.ip.fw.verbose=1 >/dev/null fi - ipfw add deny ${log} ip from any to any + ipfw add deny $log ip from any to any eend 0 } diff --git a/init.d/keymaps.in b/init.d/keymaps.in index ca35ceb8..2a1d72e3 100644 --- a/init.d/keymaps.in +++ b/init.d/keymaps.in @@ -4,23 +4,24 @@ description="Applies a keymap for the consoles." -ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} -unicode=${unicode:-${UNICODE}} -keymap=${keymap:-${KEYMAP}} -extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}} -windowkeys=${windowkeys:-${SET_WINDOWSKEYS}} -fix_euro=${fix_euro:-${FIX_EURO}} -dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}} - depend() { need localmount termencoding + after bootmisc keyword noopenvz noprefix nouml novserver noxenu } start() { - if [ -z "${keymap}" ]; then + ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} + : ${unicode:=$UNICODE} + : =${keymap:=$KEYMAP} + : ${extended_keymaps:=$EXTENDED_KEYMAPS} + : ${windowkeys:=$SET_WINDOWSKEYS} + : ${fix_euro:=$FIX_EURO} + : ${dumpkeys_charset:=${DUMPKEYS_CHARSET}} + + if [ -z "$keymap" ]; then eerror "You need to setup keymap in /etc/conf.d/keymaps first" return 1 fi @@ -33,18 +34,18 @@ start() echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes fi - ebegin "Loading key mappings [${keymap}]" + ebegin "Loading key mappings [$keymap]" local loadkeys_uni= wkeys= kmode="-a" msg="ASCII" - if yesno ${unicode}; then + if yesno $unicode; then loadkeys_uni="--unicode" kmode="-u" msg="UTF-8" fi - yesno ${windowkeys} && wkeys="windowkeys" - loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} + yesno $windowkeys && wkeys="windowkeys" + loadkeys -q $loadkeys_uni $wkeys $keymap $extended_keymaps eend $? "Error loading key mappings" || return $? - if yesno ${fix_euro}; then + if yesno $fix_euro; then ebegin "Fixing font for euro symbol" # Fix some fonts displaying the Euro, #173528. echo "altgr keycode 18 = U+20AC" | loadkeys -q @@ -53,21 +54,21 @@ start() # Set terminal encoding to either ASCII or UNICODE. # See utf-8(7) for more information. - ebegin "Setting keyboard mode [${msg}]" - if yesno ${unicode}; then + ebegin "Setting keyboard mode [$msg]" + if yesno $unicode; then dumpkeys ${dumpkeys_charset:+-c} \ - ${dumpkeys_charset} | loadkeys --unicode + $dumpkeys_charset | loadkeys --unicode fi n=1 - while [ ${n} -le "${ttyn}" ]; do - kbd_mode "${kmode}" -C "${ttydev}${n}" - n=$((${n} + 1)) + while [ $n -le $ttyn ]; do + kbd_mode $kmode -C $ttydev$n + n=$(($n + 1)) done eend 0 # Save the keymapping for use immediately at boot - if [ -w "${RC_LIBDIR}" ]; then - mkdir -p "${RC_LIBDIR}"/console - dumpkeys >"${RC_LIBDIR}"/console/keymap + if [ -w "$RC_LIBDIR" ]; then + mkdir -p "$RC_LIBDIR"/console + dumpkeys >"$RC_LIBDIR"/console/keymap fi } diff --git a/init.d/localmount.in b/init.d/localmount.in index 2cdc0c57..30a8fa9c 100644 --- a/init.d/localmount.in +++ b/init.d/localmount.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Mounts disks and swap according to /etc/fstab." @@ -15,12 +15,12 @@ start() { # Mount local filesystems in /etc/fstab. local types="noproc" x= - for x in ${net_fs_list}; do + for x in $net_fs_list; do types="${types},${x}" done ebegin "Mounting local filesystems" - mount -at "${types}" + mount -at "$types" eend $? "Some local filesystem failed to mount" # Always return 0 - some local mounts may not be critical for boot @@ -33,31 +33,31 @@ stop() local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}" no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec" # RC_NO_UMOUNTS is an env var that can be set by plugins - OIFS=${IFS} SIFS=${IFS-y} + OIFS=$IFS SIFS=${IFS-y} IFS=$IFS: - for x in ${no_umounts} ${RC_NO_UMOUNTS}; do - no_umounts_r="${no_umounts_r}|${x}" + for x in $no_umounts $RC_NO_UMOUNTS; do + no_umounts_r="$no_umounts_r|$x" done - if [ "${SIFS}" = "y" ]; then + if [ "$SIFS" = y ]; then IFS=$OIFS else unset IFS fi - if [ "${RC_UNAME}" = "Linux" ]; then - no_umounts_r="${no_umounts_r}|/proc|/proc/.*|/sys|/sys/.*" + if [ "$RC_UNAME" = Linux ]; then + no_umounts_r="$no_umounts_r|/proc|/proc/.*|/sys|/sys/.*" fi - no_umounts_r="^(${no_umounts_r})$" + no_umounts_r="^($no_umounts_r)$" # Flush all pending disk writes now sync; sync - . "${RC_LIBDIR}"/sh/rc-mount.sh + . "$RC_LIBDIR"/sh/rc-mount.sh # Umount loopback devices einfo "Unmounting loopback devices" eindent - do_unmount "umount -d" --skip-point-regex "${no_umounts_r}" \ + do_unmount "umount -d" --skip-point-regex "$no_umounts_r" \ --node-regex "^/dev/loop" eoutdent @@ -66,12 +66,12 @@ stop() einfo "Unmounting filesystems" eindent local fs= - for x in ${net_fs_list}; do - fs="${fs}${fs:+|}${x}" + for x in $net_fs_list; do + fs="$fs${fs:+|}$x" done - [ -n "${fs}" ] && fs="^(${fs})$" - do_unmount "umount" --skip-point-regex "${no_umounts_r}" \ - ${fs:+--skip-fstype-regex} ${fs} --nonetdev + [ -n "$fs" ] && fs="^($fs)$" + do_unmount umount --skip-point-regex "$no_umounts_r" \ + ${fs:+--skip-fstype-regex} $fs --nonetdev eoutdent return 0 diff --git a/init.d/mixer.in b/init.d/mixer.in index f496bd18..c04593dc 100644 --- a/init.d/mixer.in +++ b/init.d/mixer.in @@ -17,8 +17,8 @@ restore() eindent for mixer in /dev/mixer*; do if [ -r "/var/db/${mixer#/dev/}-state" ]; then - vebegin "${mixer}" - mixer -f "${mixer}" \ + vebegin "$mixer" + mixer -f "$mixer" \ $(cat "/var/db/${mixer#/dev/}-state") >/dev/null veend $? : $((retval += $?)) @@ -37,11 +37,11 @@ stop() ebegin "Saving mixer settings" eindent for mixer in /dev/mixer*; do - vebegin "${mixer}" - mixer -f "${mixer}" -s >/var/db/"${mixer#/dev/}"-state + vebegin "$mixer" + mixer -f "$mixer" -s >/var/db/"${mixer#/dev/}"-state veend $? : $((retval += $?)) done eoutdent - eend ${retval} + eend $retval } diff --git a/init.d/modules.in b/init.d/modules.in index c12f7c19..ee9eb880 100644 --- a/init.d/modules.in +++ b/init.d/modules.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Loads a user defined list of kernel modules." @@ -24,40 +24,40 @@ start() local KV_MICRO=${x%%-*} local list= x= xx= y= args= mpargs= cnt=0 a= - for x in "${KV}" \ - ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \ - ${KV_MAJOR}.${KV_MINOR} \ + for x in "$KV" \ + $KV_MAJOR.$KV_MINOR.$KV_MICRO \ + $KV_MAJOR.$KV_MINOR \ ; do - eval list=\$modules_$(shell_var "${x}") - [ -n "${list}" ] && break + eval list=\$modules_$(shell_var "$x") + [ -n "$list" ] && break done - [ -z "${list}" ] && list=${modules} + [ -z "$list" ] && list=$modules - for x in ${list}; do + for x in $list; do a=${x#*:} - if [ "${a}" = "${x}" ]; then + if [ "$a" = "$x" ]; then unset mpargs - ebegin "Loading module ${x}" + ebegin "Loading module $x" else x=${x%%:*} - mpargs="-o ${a}" - ebegin "Loading module ${x} as ${a}" + mpargs="-o $a" + ebegin "Loading module $x as $a" fi - aa=$(shell_var "${a}") - xx=$(shell_var "${x}") - for y in "${KV}" \ - ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \ - ${KV_MAJOR}.${KV_MINOR} \ + aa=$(shell_var "$a") + xx=$(shell_var "$x") + for y in "$KV" \ + $KV_MAJOR.$KV_MINOR.$KV_MICRO \ + $KV_MAJOR.$KV_MINOR \ ; do - eval args=\$module_${aa}_args_$(shell_var "${y}") + eval args=\$module_${aa}_args_$(shell_var "$y") [ -n "${args}" ] && break - eval args=\$module_${xx}_args_$(shell_var "${y}") + eval args=\$module_${xx}_args_$(shell_var "$y") [ -n "${args}" ] && break done - [ -z "${args}" ] && eval args=\$module_${aa}_args - [ -z "${args}" ] && eval args=\$module_${xx}_args - eval modprobe -q "${mpargs}" "${x}" "${args}" - eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1)) + [ -z "$args" ] && eval args=\$module_${aa}_args + [ -z "$args" ] && eval args=\$module_${xx}_args + eval modprobe -q "$mpargs" "$x" "$args" + eend $? "Failed to load $x" && cnt=$(($cnt + 1)) done - einfo "Autoloaded ${cnt} module(s)" + einfo "Autoloaded $cnt module(s)" } diff --git a/init.d/mount-ro.in b/init.d/mount-ro.in index 2e418724..f466cbac 100644 --- a/init.d/mount-ro.in +++ b/init.d/mount-ro.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Re-mount filesytems read-only for a clean reboot." @@ -17,30 +17,30 @@ start() ebegin "Remounting remaining filesystems read-only" # We need the do_unmount function - . "${RC_LIBDIR}"/sh/rc-mount.sh + . "$RC_LIBDIR"/sh/rc-mount.sh eindent local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs= - m="${m}|/bin|/sbin|/lib|/libexec" + m="$m|/bin|/sbin|/lib|/libexec" # RC_NO_UMOUNTS is an env var that can be set by plugins local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS IFS=$IFS: - for x in ${no_umounts} ${RC_NO_UMOUNTS}; do - m="${m}|${x}" + for x in $no_umounts $RC_NO_UMOUNTS; do + m="$m|$x" done - if [ "${SIFS}" = y ]; then + if [ "$SIFS" = y ]; then IFS=$OIFS else unset IFS fi - m="^(${m})$" + m="^($m)$" fs= - for x in ${net_fs_list}; do - fs="${fs}${fs:+|}${x}" + for x in $net_fs_list; do + fs="$fs${fs:+|}$x" done - [ -n "${fs}" ] && fs="^(${fs})$" + [ -n "$fs" ] && fs="^($fs)$" do_unmount "umount -r" \ - --skip-point-regex "${m}" \ - ${fs:+--skip-fstype-regex} ${fs} --nonetdev + --skip-point-regex "$m" \ + ${fs:+--skip-fstype-regex} $fs --nonetdev eoutdent eend $? } diff --git a/init.d/moused.in b/init.d/moused.in index a0e97cdf..ae05bb9c 100644 --- a/init.d/moused.in +++ b/init.d/moused.in @@ -1,16 +1,16 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. mouse=${RC_SVCNAME##*.} -if [ -n "${name}" -a "${mouse}" != "moused" ]; then - moused_device=/dev/"${mouse}" - pidfile=/var/run/moused-"${mouse}".pid +if [ -n "$mouse" -a "$mouse" != "moused" ]; then + moused_device=/dev/"$mouse" + pidfile=/var/run/moused-"$mouse".pid else pidfile=/var/run/moused.pid fi name="Console Mouse Daemon" -[ -n "${moused_device}" ] && name="${name} (${moused_device})" +[ -n "$moused_device" ] && name="$name ($moused_device)" depend() { @@ -21,42 +21,42 @@ depend() start() { - ebegin "Starting ${name}" + ebegin "Starting $name" - if [ -z "${moused_device}" ]; then + if [ -z "$moused_device" ]; then local dev= for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do - [ -c "${dev}" ] || continue + [ -c "$dev" ] || continue [ -e /var/run/moused-"${dev##*/}".pid ] && continue - moused_device=${dev} + moused_device=$dev eindent - einfo "Using mouse on ${moused_device}" + einfo "Using mouse on $moused_device" eoutdent break done fi - if [ -z "${moused_device}" ]; then + if [ -z "$moused_device" ]; then eend 1 "No mouse device found" return 1 fi local args= eval args=\$moused_args_${moused_device##*/} - [ -z "${args}" ] && args=${moused_args} + [ -z "$args" ] && args=$moused_args start-stop-daemon --start --exec /usr/sbin/moused \ - --pidfile "${pidfile}" \ - -- ${args} -p "${moused_device}" -I "${pidfile}" + --pidfile "$pidfile" \ + -- $args -p "$moused_device" -I "$pidfile" local retval=$? - if [ ${retval} = 0 ]; then + if [ $retval = 0 ]; then local ttyv= for ttyv in /dev/ttyv*; do - vidcontrol < "${ttyv}" -m on + vidcontrol < "$ttyv" -m on : $((retval+= $?)) done fi - eend ${retval} "Failed to start moused" + eend $retval "Failed to start moused" } diff --git a/init.d/netmount.in b/init.d/netmount.in index 156ac366..14b41e7d 100644 --- a/init.d/netmount.in +++ b/init.d/netmount.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Mounts network shares according to /etc/fstab." @@ -11,7 +11,7 @@ need_portmap() " set -- $(fstabinfo --options --fstype nfs,nfs4) for opts; do - case ,${opts}, in + case ,$opts, in *,noauto,*|*,nolock,*);; *) return 0;; esac @@ -27,12 +27,12 @@ depend() if need_portmap; then pmap="rpc.statd" [ -x @SYSCONFDIR@/init.d/rpcbind ] \ - && pmap="${pmap} rpcbind" \ - || pmap="${pmap} portmap" + && pmap="$pmap rpcbind" \ + || pmap="$pmap portmap" fi config /etc/fstab - need net ${pmap} + need net $pmap use afc-client amd autofs openvpn use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd keyword nojail noprefix novserver @@ -44,8 +44,8 @@ start() [ -x @SYSCONFDIR@/init.d/rpcbind ] && pmap="rpcbind" local x= fs= - for x in ${net_fs_list}; do - case "${x}" in + for x in $net_fs_list; do + case "$x" in nfs|nfs4) # If the nfsmount script took care of the nfs # filesystems, then there's no point in trying @@ -55,16 +55,16 @@ start() # Only try to mount NFS filesystems if portmap was # started. This is to fix "hang" problems for new # users who do not add portmap to the default runlevel. - if need_portmap && ! service_started "${pmap}"; then + if need_portmap && ! service_started "$pmap"; then continue fi ;; esac - fs="${fs}${fs:+,}${x}" + fs="$fs${fs:+,}$x" done ebegin "Mounting network filesystems" - mount -at ${fs} + mount -at $fs ewend $? "Could not mount all network filesystems" return 0 } @@ -74,24 +74,24 @@ stop() local x= fs= ebegin "Unmounting network filesystems" - . "${RC_LIBDIR}/sh/rc-mount.sh" + . "$RC_LIBDIR"/sh/rc-mount.sh - for x in ${net_fs_list}; do - fs="${fs}${fs:+,}${x}" + for x in $net_fs_list; do + fs="$fs${fs:+,}$x" done - if [ -n "${fs}" ]; then - umount -at ${fs} || eerror "Failed to simply unmount filesystems" + if [ -n "$fs" ]; then + umount -at $fs || eerror "Failed to simply unmount filesystems" fi eindent fs= - for x in ${net_fs_list}; do - fs="${fs}${fs:+|}${x}" + for x in $net_fs_list; do + fs="$fs${fs:+|}$x" done - [ -n "${fs}" ] && fs="^(${fs})$" - do_unmount "umount" ${fs:+--fstype-regex} ${fs} --netdev + [ -n "$fs" ] && fs="^($fs)$" + do_unmount umount ${fs:+--fstype-regex} $fs --netdev retval=$? eoutdent - eend ${retval} "Failed to unmount network filesystems" + eend $retval "Failed to unmount network filesystems" } diff --git a/init.d/network.in b/init.d/network.in index 0c1e3616..379b9a39 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -186,7 +186,7 @@ start() intv=$(shell_var "$int") eval upcmd=\$ifup_$intv for func in ip ifconfig; do - eval cmd=\$${func}_${intv} + eval cmd=\$${func}_$intv if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then cf=/etc/"$func.$int" break diff --git a/init.d/newsyslog.in b/init.d/newsyslog.in index 04ca7928..685557fa 100644 --- a/init.d/newsyslog.in +++ b/init.d/newsyslog.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. required_files="/etc/newsyslog.conf" @@ -13,6 +13,6 @@ depend() start() { ebegin "Creating and/or trimming log files" - newsyslog -s ${newsyslog_args} + newsyslog -s $newsyslog_args eend $? } diff --git a/init.d/nscd.in b/init.d/nscd.in index e70ba4a3..a2ddc4a1 100644 --- a/init.d/nscd.in +++ b/init.d/nscd.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/nscd -command_args="${nscd_args}" +command_args=$nscd_args pidfile=/var/run/nscd.pid name="Name Service Cache Daemon" @@ -16,7 +16,7 @@ depend() { } flush() { - ebegin "Flushing ${name}" + ebegin "Flushing $name" nscd -I all >/dev/null eend $? } diff --git a/init.d/numlock.in b/init.d/numlock.in index 06adca7f..762f4ef3 100644 --- a/init.d/numlock.in +++ b/init.d/numlock.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Turns numlock on for the consoles." @@ -19,12 +19,12 @@ _setleds() local dev=/dev/tty t= i=1 retval=0 [ -d /dev/vc ] && dev=/dev/vc/ - while [ ${i} -le ${ttyn} ]; do - setleds -D "$1"num < ${dev}${i} || retval=1 - i=$((${i} + 1)) + while [ $i -le $ttyn ]; do + setleds -D "$1"num < $dev$i || retval=1 + i=$(($i + 1)) done - return ${retval} + return $retval } start() diff --git a/init.d/pf.in b/init.d/pf.in index fa55ea48..13b8ed15 100644 --- a/init.d/pf.in +++ b/init.d/pf.in @@ -1,10 +1,10 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. name="Packet Filter" -pf_conf=${pf_conf:-${pf_rules:-/etc/pf.conf}} -required_files=${pf_conf} +: ${pf_conf:=${pf_rules:-/etc/pf.conf}} +required_files=$pf_conf extra_commands="checkconfig showstatus" extra_started_commands="reload" @@ -16,39 +16,39 @@ depend() { start() { - ebegin "Starting ${name}" + ebegin "Starting $name" if type kldload >/dev/null 2>&1; then kldload pf 2>/dev/null fi pfctl -q -F all - pfctl -q -f "${pf_conf}" ${pf_args} + pfctl -q -f "$pf_conf" $pf_args pfctl -q -e eend $? } stop() { - ebegin "Stopping ${name}" + ebegin "Stopping $name" pfctl -q -d eend $? } checkconfig() { - ebegin "Checking ${name} configuration" - pfctl -n -f "${pf_conf}" + ebegin "Checking $name configuration" + pfctl -n -f "$pf_conf" eend $? } reload() { - ebegin "Reloading ${name} rules." - pfctl -q -n -f "${pf_conf}" && \ + ebegin "Reloading $name rules." + pfctl -q -n -f "$pf_conf" && \ { # Flush everything but existing state entries that way when # rules are read in, it doesn't break established connections. pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp - pfctl -q -f "${pf_conf}" ${pf_args} + pfctl -q -f "$pf_conf" $pf_args } eend $? } diff --git a/init.d/powerd.in b/init.d/powerd.in index 1c2d8456..d3ea4ded 100644 --- a/init.d/powerd.in +++ b/init.d/powerd.in @@ -1,9 +1,9 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/powerd -command_args=${powerd_args} +command_args=$powerd_args pidfile=/var/run/powerd.pid name="Power Control Daemon" @@ -17,11 +17,11 @@ depend() start_pre() { - if [ -n "${powerd_battery_mode}" ]; then - command_args="${command_args} -b ${powerd_battery_mode}" + if [ -n "$powerd_battery_mode" ]; then + command_args="$command_args -b $powerd_battery_mode" fi if [ -n "${powerd_ac_mode}" ]; then - command_args="${command_args} -a ${powerd_ac_mode}" + command_args="$command_args -a $powerd_ac_mode" fi } @@ -29,7 +29,7 @@ stop_post() { local level=$(sysctl -n dev.cpu.0.freq_levels | sed -e 's:/.*::') - if [ -n "${level}" ]; then - sysctl dev.cpu.0.freq="${level}" >/dev/null + if [ -n "$level" ]; then + sysctl dev.cpu.0.freq="$level" >/dev/null fi } diff --git a/init.d/procfs.in b/init.d/procfs.in index b6dfbb62..838b2aca 100644 --- a/init.d/procfs.in +++ b/init.d/procfs.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Mounts misc filesystems in /proc." @@ -25,13 +25,13 @@ start() # while older kernels have 'usbdevfs'. if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then local usbfs=$(grep -Fow usbfs /proc/filesystems || - grep -Fow usbdevfs /proc/filesystems) - if [ -n "${usbfs}" ]; then - ebegin "Mounting USB device filesystem [${usbfs}]" + grep -Fow usbdevfs /proc/filesystems) + if [ -n "$usbfs" ]; then + ebegin "Mounting USB device filesystem [$usbfs]" local usbgid="$(getent group usb | \ sed -e 's/.*:.*:\(.*\):.*/\1/')" - mount -t ${usbfs} \ - -o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \ + mount -t $usbfs \ + -o ${usbgid:+devmode=0664,devgid=$usbgid,}noexec,nosuid \ usbfs /proc/bus/usb eend $? fi @@ -48,7 +48,8 @@ start() fi # Setup Kernel Support for miscellaneous Binary Formats - if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc; then + if [ -d /proc/sys/fs/binfmt_misc ] \ + && ! mountinfo -q /proc/sys/fs/binfmt_misc; then if grep -qs binfmt_misc /proc/filesystems; then ebegin "Mounting misc binary format filesystem" mount -t binfmt_misc -o nodev,noexec,nosuid \ diff --git a/init.d/rarpd.in b/init.d/rarpd.in index e7510990..0b0e6611 100644 --- a/init.d/rarpd.in +++ b/init.d/rarpd.in @@ -3,26 +3,21 @@ # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/rarpd -command_args="-f ${rarpd_args}" +command_args="-f $rarpd_args" pidfile=/var/run/rarpd.pid name="Reverse ARP Daemon" -required_files="/etc/ethers" +required_files=/etc/ethers -if [ -z "${rarpd_interface}" ]; then - command_args="${command_args} -a" +if [ -z "$rarpd_interface" ]; then + command_args="$command_args -a" else - command_args="${command_args} ${rarpd_interface}" + command_args="$command_args $rarpd_interface" fi -command_background="YES" +command_background=YES depend() { need localmount after bootmisc - - if [ -z "${rarpd_interface}" ]; then - need net - else - net net."${rarpd_interface}" - fi + need net } diff --git a/init.d/rc-enabled.in b/init.d/rc-enabled.in index 82dc5964..f01870a9 100644 --- a/init.d/rc-enabled.in +++ b/init.d/rc-enabled.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() @@ -20,21 +20,21 @@ start() # Skip these services for s in cleartmp moused; do - [ "${s}" = "${service}" ] && continue 2 + [ "$s" = "$service" ] && continue 2 done # If we have an init script for this service, continue - rc-service --exists "${service}" && continue + rc-service --exists "$service" && continue # Ensure that the users rc.conf will start us - ignore the defaults eval enabled=\$${svc##*/}_enable - yesno ${enabled} || yesno ${svc##*/} || continue + yesno $enabled || yesno ${svc##*/} || continue # Good to go! - "$svc" start && started="${started} ${svc}" + "$svc" start && started="$started $svc" : $((retval += $?)) done - service_set_value started "${started}" + service_set_value started "$started" eend $retval "Some local rc services failed to start" return 0 } @@ -44,7 +44,7 @@ stop() ebegin "Stopping local rc services" local svc= retval=0 for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do - "${svc}" stop + "$svc" stop : $((retval += $?)) done eend $retval "Some local rc services failed to stop" diff --git a/init.d/root.in b/init.d/root.in index 8d85acf2..25a37a5d 100644 --- a/init.d/root.in +++ b/init.d/root.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Mount the root fs read/write" @@ -22,7 +22,7 @@ start() fi ebegin "Remounting root filesystem read/write" - case "${RC_UNAME}" in + case "$RC_UNAME" in Linux) mount -n -o remount,rw /;; *) mount -u -o rw /;; esac diff --git a/init.d/rpcbind.in b/init.d/rpcbind.in index 2d053ebd..160c8368 100644 --- a/init.d/rpcbind.in +++ b/init.d/rpcbind.in @@ -1,9 +1,9 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/rpcbind -command_args=${rpcbind_args} +command_args=$rpcbind_args name="RPC program number mapper" depend() diff --git a/init.d/savecache.in b/init.d/savecache.in index a10de3c2..eda0aa01 100644 --- a/init.d/savecache.in +++ b/init.d/savecache.in @@ -6,7 +6,7 @@ description="Saves the caches OpenRC uses to non volatile storage" start() { - if [ -e "${RC_SVCDIR}"/clock-skewed ]; then + if [ -e "$RC_SVCDIR"/clock-skewed ]; then ewarn "WARNING: clock skew detected!" if ! yesno "savecache_skewed"; then eerror "Not saving deptree cache" @@ -14,19 +14,19 @@ start() fi fi ebegin "Saving dependency cache" - if [ ! -d "${RC_LIBDIR}"/cache ]; then - rm -rf "${RC_LIBDIR}"/cache - if ! mkdir "${RC_LIBDIR}"/cache; then + if [ ! -d "$RC_LIBDIR"/cache ]; then + rm -rf "$RC_LIBDIR"/cache + if ! mkdir "$RC_LIBDIR"/cache; then eend $? return $? fi fi local save= for x in deptree depconfig softlevel nettree rc.log; do - [ -e "${RC_SVCDIR}/${x}" ] && save="${save} ${RC_SVCDIR}/${x}" + [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" done - if [ -n "${save}" ]; then - cp -p ${save} "${RC_LIBDIR}"/cache 2>/dev/null + if [ -n "$save" ]; then + cp -p $save "$RC_LIBDIR"/cache 2>/dev/null fi eend $? } diff --git a/init.d/savecore.in b/init.d/savecore.in index e23bde48..af2325a1 100644 --- a/init.d/savecore.in +++ b/init.d/savecore.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Saves a kernel dump." @@ -12,25 +12,25 @@ depend() start() { - local dump_dir=${dump_dir:-/var/crash} - if ! [ -d "${dump_dir}" ]; then - mkdir -p "${dump_dir}" - chmod 700 "${dump_dir}" + : ${dump_dir:=/var/crash} + if ! [ -d "$dump_dir" ]; then + mkdir -p "$dump_dir" + chmod 700 "$dump_dir" fi - if [ "${RC_UNAME}" = "FreeBSD" ]; then + if [ "$RC_UNAME" = FreeBSD ]; then # Don't quote ${dump_device}, so that if it's unset, # savecore will check on the partitions listed in fstab # without errors in the output - savecore -C "${dump_dir}" ${dump_device} >/dev/null + savecore -C "$dump_dir" $dump_device >/dev/null else - ls "${dump_dir}"/bsd* > /dev/null 2>&1 + ls "$dump_dir"/bsd* > /dev/null 2>&1 fi [ $? = 0 ] || return 0 - local sopts="${dump_dir} ${dump_device}" - yesno ${dump_compress} && sopts="-z ${sopts}" - ebegin "Saving kernel core dump in ${dump_dir}" - savecore ${sopts} >/dev/null + local sopts="$dump_dir $dump_device" + yesno $dump_compress && sopts="-z $sopts" + ebegin "Saving kernel core dump in $dump_dir" + savecore $sopts >/dev/null eend $? } diff --git a/init.d/swap.in b/init.d/swap.in index bad2b13b..34393c94 100644 --- a/init.d/swap.in +++ b/init.d/swap.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() @@ -11,7 +11,7 @@ depend() start() { ebegin "Activating swap devices" - case "${RC_UNAME}" in + case "$RC_UNAME" in NetBSD|OpenBSD) swapctl -A -t noblk >/dev/null;; *) swapon -a >/dev/null;; esac @@ -24,10 +24,10 @@ stop() # Try to unmount all tmpfs filesystems not in use, else a deadlock may # occure. As $RC_SVCDIR may also be tmpfs we cd to it to lock it - cd "${RC_SVCDIR}" + cd "$RC_SVCDIR" umount -a -t tmpfs 2>/dev/null - case "${RC_UNAME}" in + case "$RC_UNAME" in NetBSD|OpenBSD) swapctl -U -t noblk >/dev/null;; *) swapoff -a >/dev/null;; esac diff --git a/init.d/syscons.in b/init.d/syscons.in index 4994f5ab..06efaf59 100644 --- a/init.d/syscons.in +++ b/init.d/syscons.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() { @@ -8,29 +8,29 @@ depend() { } start() { - if [ -n "${allscreen_flags}" ]; then - ebegin "Setting mode to ${allscreen_flags} for all screens" + if [ -n "$allscreen_flags" ]; then + ebegin "Setting mode to $allscreen_flags for all screens" for v in /dev/ttyv*; do - vidcontrol ${allscreen_flags} <"${v}" + vidcontrol $allscreen_flags <$v done eend $? fi - if [ -n "${keymap}" ]; then - ebegin "Setting keymap to ${keymap}" - kbdcontrol -l ${keymap} </dev/console + if [ -n "$keymap" ]; then + ebegin "Setting keymap to $keymap" + kbdcontrol -l $keymap </dev/console eend $? fi - if [ -n "${keyrate}" ]; then - ebegin "Setting keyrate to ${keyrate}" - kbdcontrol -r ${keyrate} </dev/console + if [ -n "$keyrate" ]; then + ebegin "Setting keyrate to $keyrate" + kbdcontrol -r $keyrate </dev/console eend $? fi - if [ -n "${keychange}" ]; then + if [ -n "$keychange" ]; then ebegin "Changing function keys" - eval set -- "${keychange}" + eval set -- "$keychange" eindent while [ $# -gt 0 ]; do veinfo "F$1 -> \`$2'" @@ -41,40 +41,40 @@ start() { eoutdent fi - if [ -n "${cursor}" ]; then + if [ -n "$cursor" ]; then ebegin "Setting cursor" - vidcontrol -c ${cursor} + vidcontrol -c $cursor eend $? fi local v= f= for v in font8x16 font8x14 font8x8; do - eval f=\$${v} - if [ -n "${f}" ]; then - ebegin "Setting font ${f}" - vidcontrol -f ${v##font} ${f} + eval f=\$$v + if [ -n "$f" ]; then + ebegin "Setting font $f" + vidcontrol -f ${v##font} $f eend $? fi done - if [ -n "${blanktime}" ]; then + if [ -n "$blanktime" ]; then ebegin "Setting blanktime" - vidcontrol -t ${blanktime} + vidcontrol -t $blanktime eend $? fi - if [ -n "${saver}" ]; then + if [ -n "$saver" ]; then local i= for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do - kldunload "${i}" + kldunload "$i" done kldstat -v | grep -q _saver || kldload ${saver}_saver fi - if [ -n "${kbdflags}" ]; then + if [ -n "$kbdflags" ]; then ebegin "Setting keyboard flags for all screens" for v in /dev/ttyv*; do - kbdcontrol ${kbdflags} <${v} + kbdcontrol $kbdflags <$v done eend $? fi diff --git a/init.d/sysctl.BSD.in b/init.d/sysctl.BSD.in index 6131a0b6..6db6e7ea 100644 --- a/init.d/sysctl.BSD.in +++ b/init.d/sysctl.BSD.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() @@ -15,10 +15,10 @@ start() local retval=0 var= comments= ebegin "Configuring kernel parameters" while read var comments; do - case "${var}" in + case "$var" in ""|"#"*) continue;; esac - sysctl -w "${var}" >/dev/null || retval=1 + sysctl -w "$var" >/dev/null || retval=1 done < /etc/sysctl.conf - eend ${retval} "Some errors were encountered" + eend $retval "Some errors were encountered" } diff --git a/init.d/sysfs.in b/init.d/sysfs.in index 07f62347..60f629f1 100644 --- a/init.d/sysfs.in +++ b/init.d/sysfs.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Mount the sys filesystem." @@ -31,7 +31,8 @@ mount_sys() mount_misc() { # Setup Kernel Support for securityfs - if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then + if [ -d /sys/kernel/security ] && \ + ! mountinfo -q /sys/kernel/security; then if grep -qs securityfs /proc/filesystems; then ebegin "Mounting security filesystem" mount -n -t securityfs -o nodev,noexec,nosuid \ @@ -56,8 +57,8 @@ start() local retval mount_sys retval=$? - if [ ${retval} -eq 0 ]; then + if [ $retval -eq 0 ]; then mount_misc fi - return ${retval} + return $retval } diff --git a/init.d/syslogd.in b/init.d/syslogd.in index b39a7d3c..914125ab 100644 --- a/init.d/syslogd.in +++ b/init.d/syslogd.in @@ -1,10 +1,10 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/syslogd -command_args=${syslogd_args} -case "${RC_UNAME}" in +command_args=$syslogd_args +case "$RC_UNAME" in FreeBSD|DragonFly) pidfile=/var/run/syslog.pid;; *) pidfile=/var/run/syslogd.pid;; esac diff --git a/init.d/termencoding.in b/init.d/termencoding.in index 4340b559..985c6c91 100644 --- a/init.d/termencoding.in +++ b/init.d/termencoding.in @@ -1,11 +1,11 @@ #!@PREFIX@/sbin/runscript -# Copyright 2008 Roy Marples <roy@marples.name> +# Copyright 2008-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. description="Configures terminal encoding." ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} -unicode=${unicode:-${UNICODE}} +: ${unicode:=${UNICODE}} depend() { @@ -25,11 +25,11 @@ start() termmsg="UTF-8" fi - ebegin "Setting terminal encoding [${termmsg}]" + ebegin "Setting terminal encoding [$termmsg]" n=1 - while [ ${n} -le "${ttyn}" ]; do - printf "\033%s" "${termencoding}" >"${ttydev}${n}" - n=$((${n} + 1)) + while [ ${n} -le "$ttyn" ]; do + printf "\033%s" "$termencoding" >$ttydev$n + n=$(($n + 1)) done eend 0 } diff --git a/init.d/urandom.in b/init.d/urandom.in index 904607ae..085332c6 100644 --- a/init.d/urandom.in +++ b/init.d/urandom.in @@ -1,9 +1,8 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. -urandom_seed=${urandom_seed:-${URANDOM_SEED:-/var/run/random-seed}} - +: ${urandom_seed:=${URANDOM_SEED:-/var/run/random-seed}} description="Initializes the random number generator." depend() @@ -22,19 +21,19 @@ save_seed() ( # sub shell to prevent umask pollution umask 077 - dd if=/dev/urandom of="${urandom_seed}" count=${psz} 2>/dev/null + dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null ) } start() { [ -c /dev/urandom ] || return - if [ -f "${urandom_seed}" ]; then + if [ -f "$urandom_seed" ]; then ebegin "Initializing random number generator" - cat "${urandom_seed}" > /dev/urandom + cat "$urandom_seed" > /dev/urandom eend $? "Error initializing random number generator" fi - rm -f "${urandom_seed}" && save_seed + rm -f "$urandom_seed" && save_seed return 0 } diff --git a/init.d/wscons.in b/init.d/wscons.in index 15e5b56b..e5dfaa02 100644 --- a/init.d/wscons.in +++ b/init.d/wscons.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2008 Roy Marples <roy@marples.name> +# Copyright 2008-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() @@ -19,82 +19,82 @@ start() # screen idx scr emul # font name width height enc file while read type arg1 arg2 arg3 arg4 arg5; do - case "${type}" in + case "$type" in \#*|"") continue ;; font) - cmd=${wsfld} - [ "${arg2}" != "-" ] && cmd="${cmd} -w ${arg2}" - [ "${arg3}" != "-" ] && cmd="${cmd} -h ${arg3}" - [ "${arg4}" != "-" ] && cmd="${cmd} -e ${arg4}" - cmd="${cmd} -N ${arg1} ${arg5}" - eval "${cmd}" + cmd=$wsfld + [ "$arg2" != "-" ] && cmd="$cmd -w $arg2" + [ "$arg3" != "-" ] && cmd="$cmd -h $arg3" + [ "$arg4" != "-" ] && cmd="$cmd -e $arg4" + cmd="$cmd -N $arg1 $arg5" + eval "$cmd" ;; screen) - cmd=${wscfg} - [ "${arg2}" != "-" ] && cmd="${cmd} -t ${arg2}" - [ "${arg3}" != "-" ] && cmd="${cmd} -e ${arg3}" - cmd="${cmd} ${arg1}" - eval "${cmd}" + cmd=$wscfg + [ "$arg2" != "-" ] && cmd="$cmd -t $arg2" + [ "$arg3" != "-" ] && cmd="$cmd -e $arg3" + cmd="$cmd $arg1" + eval "$cmd" ;; keyboard) - cmd=${wscfg} - case "${arg1}" in + cmd=$wscfg + case "$arg1" in -|auto) - cmd="${cmd} -k" + cmd="$cmd -k" ;; *) - cmd="${cmd} -k ${arg1}" + cmd="$cmd -k $arg1" ;; esac - ${cmd} + $cmd ;; encoding) - eval ${wsctl} -w "\"encoding=${arg1}\"" + eval $wsctl -w "\"encoding=$arg1\"" ;; mapfile) local entry= while read entry; do - case "${entry}" in + case "$entry" in \#*|"") continue ;; *) - cmd="${wsctl} -w \"map+=${entry}\"" - eval "${cmd} >/dev/null" + cmd="$wsctl -w \"map+=$entry\"" + eval "$cmd >/dev/null" ;; esac - done < "${arg1}" + done < "$arg1" ;; mux) - eval "${wscfg} -m ${arg1}" + eval "$wscfg -m $arg1" ;; setvar) - case "${arg1}" in + case "$arg1" in keyboard) - cmd="${wsctl} -kw ${arg2}" + cmd="$wsctl -kw $arg2" ;; display) - cmd="${wsctl} -dw ${arg2}" + cmd="$wsctl -dw $arg2" ;; mouse) - cmd="${wsctl} -mw ${arg2}" + cmd="$wsctl -mw $arg2" ;; *) - cmd="${wsctl} -w ${arg1}" + cmd="$wsctl -w $arg1" ;; esac - eval "${cmd}" + eval "$cmd" ;; esac - done < "${config}" + done < "$config" } |