aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions31
-rwxr-xr-xinstall.sh3
-rwxr-xr-xnetfs1
-rwxr-xr-xnetwork11
-rwxr-xr-xrc.sysinit10
5 files changed, 29 insertions, 27 deletions
diff --git a/functions b/functions
index 32252f5..79bd98d 100644
--- a/functions
+++ b/functions
@@ -1,6 +1,5 @@
-#!/bin/bash
#
-# functions
+# initscripts functions
#
# width:
@@ -17,7 +16,7 @@ elif [ ! -t 1 ]; then
USECOLOR=""
fi
# we use 13 characters for our own stuff
-STAT_COL=$[$STAT_COL - 13]
+STAT_COL=$(($STAT_COL - 13))
# disable colors on broken terminals
TERM_COLORS="$(tput colors 2>/dev/null)"
@@ -68,44 +67,44 @@ PREFIX_HL=" >"
# functions:
deltext() {
- echo -ne "$DEL_TEXT"
+ printf "${DEL_TEXT}"
}
printhl() {
- echo -e "$C_OTHER$PREFIX_HL $C_H1$1$C_CLEAR "
+ printf "${C_OTHER}${PREFIX_HL} ${C_H1}${1}${C_CLEAR} \n"
}
printsep() {
- echo -e "\n$C_SEPARATOR ------------------------------\n"
+ printf "\n${C_SEPARATOR} ------------------------------\n"
}
stat_bkgd() {
- echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR "
+ printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
deltext
- echo -ne " $C_OTHER[${C_BKGD}BKGD$C_OTHER]$C_CLEAR "
+ printf " ${C_OTHER}[${C_BKGD}BKGD${C_OTHER}]${C_CLEAR} "
}
stat_busy() {
- echo -ne "$C_OTHER$PREFIX_REG $C_MAIN$1$C_CLEAR "
- echo -ne "${SAVE_POSITION}"
+ printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
+ printf "${SAVE_POSITION}"
deltext
- echo -ne " $C_OTHER[${C_BUSY}BUSY$C_OTHER]$C_CLEAR "
+ printf " ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
}
stat_append() {
- echo -ne "${RESTORE_POSITION}"
- echo -ne "$C_MAIN$1$C_CLEAR"
- echo -ne "${SAVE_POSITION}"
+ printf "${RESTORE_POSITION}"
+ printf "${C_MAIN}${1}${C_CLEAR}"
+ printf "${SAVE_POSITION}"
}
stat_done() {
deltext
- echo -e " $C_OTHER[${C_DONE}DONE$C_OTHER]$C_CLEAR "
+ printf " ${C_OTHER}[${C_DONE}DONE${C_OTHER}]${C_CLEAR} \n"
}
stat_fail() {
deltext
- echo -e " $C_OTHER[${C_FAIL}FAIL$C_OTHER]$C_CLEAR "
+ printf " ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
}
stat_die() {
diff --git a/install.sh b/install.sh
index e06b6d0..a082016 100755
--- a/install.sh
+++ b/install.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-install -d -m755 ${DESTDIR}/etc/{rc.d,conf.d} || exit 1
+install -d -m755 ${DESTDIR}/etc/rc.d || exit 1
+install -d -m755 ${DESTDIR}/etc/conf.d || exit 1
install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ || exit 1
for i in inittab rc.conf; do
diff --git a/netfs b/netfs
index c381594..25db4e1 100755
--- a/netfs
+++ b/netfs
@@ -1,5 +1,6 @@
#!/bin/bash
+# sourcing our current rc.conf requires this to be a bash script
. /etc/rc.conf
. /etc/rc.d/functions
diff --git a/network b/network
index fbe77d8..81996ef 100755
--- a/network
+++ b/network
@@ -30,7 +30,8 @@ ifup()
eval ifcfg="\$${1}"
if [ "$ifcfg" = "dhcp" ]; then
# remove the .pid file if it exists
- rm -f /var/run/dhcpcd-${1}.{pid,cache} >/dev/null 2>&1
+ rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
+ rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
/sbin/dhcpcd $DHCPCD_ARGS ${1}
else
/sbin/ifconfig $ifcfg
@@ -59,9 +60,9 @@ iflist()
{
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
- echo -en " $ifline:\t"
+ printf " $ifline:\t"
else
- echo -en "$ifline:\t"
+ printf "$ifline:\t"
fi
eval real_ifline=\$${ifline#!}
echo $real_ifline
@@ -94,9 +95,9 @@ rtlist()
{
for rtline in ${ROUTES[@]}; do
if [ "$rtline" = "${rtline#!}" ]; then
- echo -en " $rtline:\t"
+ printf " $rtline:\t"
else
- echo -en "$rtline:\t"
+ printf "$rtline:\t"
fi
eval real_rtline=\$${rtline#!}
echo $real_rtline
diff --git a/rc.sysinit b/rc.sysinit
index 6dc07ae..d825b35 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -194,7 +194,7 @@ if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
fi
fi
elif [ "${cpass}" = "ASK" ]; then
- echo -e "\nOpening '${cname}' volume:"
+ printf "\nOpening '${cname}' volume:\n"
if $CS isLuks $csrc 2>/dev/null; then
$CS $copts luksOpen $csrc $cname < /dev/console
@@ -369,10 +369,10 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then
stat_busy "Setting Consoles to UTF-8"
/usr/bin/kbd_mode -u
for i in $(seq 1 63); do
- echo -ne "\e%G" > /dev/vc/${i}
+ printf "\e%G" > /dev/vc/${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
- echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then echo -ne "\e%G"; fi' >>/etc/profile.d/locale.sh
+ echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e%G"; fi' >>/etc/profile.d/locale.sh
stat_done
status "Loading Keyboard Map: $KEYMAP in utf-8 mode" /bin/loadkeys -q -u $KEYMAP
else
@@ -396,10 +396,10 @@ if [ -n "$CONSOLEFONT" ]; then
stat_fail
else
for i in $(seq 1 63); do
- echo -ne "\e(K" > /dev/vc/${i}
+ printf "\e(K" > /dev/vc/${i}
done
# the $CONSOLE check helps us avoid this when running scripts from cron
- echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then echo -ne "\e(K"; fi' >>/etc/profile.d/locale.sh
+ echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\e(K"; fi' >>/etc/profile.d/locale.sh
stat_done
fi
fi