Code Sample |
. /etc/init.d/dsl-functions CMDLINE="$(cat /proc/cmdline)" getmydsl() { for FILE in `ls $1/* 2>/dev/null`; do case $FILE in *.tar.gz) BASE=$(getbasefile "$FILE" 2) if [ "$BASE" != "backup" ]; then echo "${YELLOW}$BASE${NORMAL}" sudo su dsl -c mydsl-load $FILE fi ;; *.dsl|*.uci) BASE=$(getbasefile "$FILE" 1) echo "${YELLOW}$BASE${NORMAL}" sudo su dsl -c mydsl-load $FILE ;; esac done } MYDSL="$(getbootparam 'mydsldir')" if [ -n "$MYDSL" ]; then DEVICE="${MYDSL%%/*}" MOUNTED=`grep "/dev/$DEVICE" /etc/mtab 2>/dev/null` if [ -n "$MOUNTED" ]; then DIR="/cdrom/${MYDSL#*/}" else DIR="/mnt/$DEVICE/${MYDSL#*/}" mount /dev/$DEVICE &>/dev/null fi if [ -d "$DIR" ]; then getmydsl "$DIR" fi fi |
Code Sample |
if [ "${MYDSL##*/}" = "xfree" ]; then do some commands for xfree only fi |