Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/examples
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (9 years ago)
- Location:
- branches/3.3
- Files:
-
- 26 added
- 21 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/examples/inittab
r2725 r3621 16 16 # appended to "/dev/" and used as-is. There is no need for this field to 17 17 # be unique, although if it isn't you may have strange results. If this 18 # field is left blank, it is completely ignored. Also note that if 19 # BusyBox detects that a serial console is in use, then all entries 20 # containing non-empty id fields will be ignored. BusyBox init does 21 # nothing with utmp. We don't need no stinkin' utmp. 18 # field is left blank, then the init's stdin/out will be used. 22 19 # 23 20 # <runlevels>: The runlevels field is completely ignored. … … 44 41 # ::shutdown:/bin/umount -a -r 45 42 # ::restart:/sbin/init 46 #47 # if it detects that /dev/console is _not_ a serial console, it will48 # also run:49 43 # tty2::askfirst:/bin/sh 50 44 # tty3::askfirst:/bin/sh -
branches/3.3/mindi-busybox/examples/mdev_fat.conf
r3232 r3621 8 8 # 9 9 # Syntax: 10 # [-] devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]11 # [-] $ENVVAR=regexuser:group mode [=path]|[>path]|[!] [@|$|*cmd args...]12 # [-] @maj,min[-min2]user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]10 # [-][ENVVAR=regex;]...devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 11 # [-][ENVVAR=regex;]...@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 12 # [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 13 13 # 14 14 # [-]: do not stop on this match, continue reading mdev.conf … … 20 20 $MODALIAS=.* root:root 660 @modprobe "$MODALIAS" 21 21 22 # null may already exist; therefore ownershiphas to be changed with command22 # null may already exist; therefore mode has to be changed with command 23 23 null root:root 666 @chmod 666 $MDEV 24 24 zero root:root 666 … … 32 32 mem root:root 640 33 33 port root:root 640 34 # console may already exist; therefore ownershiphas to be changed with command34 # console may already exist; therefore mode has to be changed with command 35 35 console root:tty 600 @chmod 600 $MDEV 36 36 ptmx root:tty 666 … … 54 54 55 55 # net devices 56 SUBSYSTEM=net;.* root:root 600 @nameif 56 57 tun[0-9]* root:root 600 =net/ 57 58 tap[0-9]* root:root 600 =net/ … … 63 64 seq root:audio 660 =snd/ 64 65 timer root:audio 660 =snd/ 66 # for kernels/mdevs which expose full path of alsa devices: 67 snd/pcm.* root:audio 660 68 snd/control.* root:audio 660 69 snd/midi.* root:audio 660 70 snd/seq root:audio 660 71 snd/timer root:audio 660 65 72 66 73 adsp root:audio 660 >sound/ … … 112 119 zap(.*) root:dialout 660 =zap/%1 113 120 dahdi!(.*) root:dialout 660 =dahdi/%1 121 122 # HTC Android 123 # Attaching it via USB cable causes a flurry of activity: 124 # 125 # mdev[1271]: 48.639459 ACTION:add SUBSYSTEM:usb DEVNAME:bus/usb/001/009 DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5 126 # mdev[1271]: mknod bus/usb/001/009 (189,8) 20660 0:0 127 # mdev[1272]: 48.642354 ACTION:add SUBSYSTEM:usb DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0 128 # mdev[1272]: running: modprobe "$MODALIAS" 129 # mdev[1273]: 48.650078 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11 130 # mdev[1274]: 48.651297 ACTION:add SUBSYSTEM:scsi_host DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/scsi_host/host11 131 # mdev[1275]: 49.649422 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0 132 # mdev[1276]: 49.650703 ACTION:add SUBSYSTEM:scsi DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0 133 # mdev[1276]: running: modprobe "$MODALIAS" 134 # modprobe: module scsi:t-0x00 not found in modules.dep 135 # mdev[1277]: 49.658002 ACTION:add SUBSYSTEM:scsi_disk DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/scsi_disk/11:0:0:0 136 # mdev[1278]: 49.659244 ACTION:add SUBSYSTEM:scsi_device DEVNAME:(null) DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/scsi_device/11:0:0: 137 # mdev[1279]: 49.660535 ACTION:add SUBSYSTEM:bsg DEVNAME:bsg/11:0:0:0 DEVPATH:/devices/pci0000:00/0000:00:02.1/usb1/1-5/1-5:1.0/host11/target11:0:0/11:0:0:0/bsg/11:0:0:0 138 # mdev[1279]: mknod bsg/11:0:0:0 (253,1) 20660 0:0 139 # mdev[1280]: 49.663516 ACTION:add SUBSYSTEM:bdi DEVNAME:(null) DEVPATH:/devices/virtual/bdi/8:16 140 # mdev[1281]: 49.664748 ACTION:add SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb 141 # mdev[1281]: mknod sdb (8,16) 60660 0:0 142 # mdev[1282]: 49.677597 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb 143 # mdev[1283]: 50.692936 ACTION:change SUBSYSTEM:block DEVNAME:sdb DEVPATH:/block/sdb 144 # 145 # We are hooking to the last events. To avoid having two scripts running, 146 # we check for DISK_MEDIA_CHANGE=1 (prev to last event has it, 147 # and it's the _only_ difference in env for these two events as of kernel 3.7.7) 148 # Unfortunately, there is no event for "user pressed [Turn USB storage on] btn"! 149 # Script merely backgrounds and tries to rescan partition table for 1 minute: 150 ACTION=change;SUBSYSTEM=block;DISK_MEDIA_CHANGE=1;.* 0:0 660 */etc/mdev.conf.change_blockdev.sh -
branches/3.3/mindi-busybox/examples/udhcp/sample.bound
r2725 r3621 23 23 fi 24 24 25 echo -n > $RESOLV_CONF 26 [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF 27 for i in $dns 28 do 29 echo adding dns $i 30 echo nameserver $i >> $RESOLV_CONF 31 done 25 # Only replace resolv.conf is we have at least one DNS server 26 if [ -n "$dns" ] 27 then 28 echo -n > $RESOLV_CONF 29 [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF 30 for i in $dns 31 do 32 echo adding dns $i 33 echo nameserver $i >> $RESOLV_CONF 34 done 35 fi -
branches/3.3/mindi-busybox/examples/udhcp/sample.renew
r2725 r3621 23 23 fi 24 24 25 echo -n > $RESOLV_CONF 26 [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF 27 for i in $dns 28 do 29 echo adding dns $i 30 echo nameserver $i >> $RESOLV_CONF 31 done 25 # Only replace resolv.conf is we have at least one DNS server 26 if [ -n "$dns" ] 27 then 28 echo -n > $RESOLV_CONF 29 [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF 30 for i in $dns 31 do 32 echo adding dns $i 33 echo nameserver $i >> $RESOLV_CONF 34 done 35 fi -
branches/3.3/mindi-busybox/examples/udhcp/simple.script
r2725 r3621 30 30 for i in $router ; do 31 31 echo "Adding router $i" 32 route add default gw $i dev $interface metric $((metric++)) 32 route add default gw $i dev $interface metric $metric 33 : $(( metric += 1 )) 33 34 done 34 35 fi 35 36 36 37 echo "Recreating $RESOLV_CONF" 37 echo -n > $RESOLV_CONF-$$ 38 [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$ 38 # If the file is a symlink somewhere (like /etc/resolv.conf 39 # pointing to /run/resolv.conf), make sure things work. 40 realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF") 41 tmpfile="$realconf-$$" 42 > "$tmpfile" 43 [ -n "$domain" ] && echo "search $domain" >> "$tmpfile" 39 44 for i in $dns ; do 40 45 echo " Adding DNS server $i" 41 echo "nameserver $i" >> $RESOLV_CONF-$$46 echo "nameserver $i" >> "$tmpfile" 42 47 done 43 mv $RESOLV_CONF-$$ $RESOLV_CONF48 mv "$tmpfile" "$realconf" 44 49 ;; 45 50 esac -
branches/3.3/mindi-busybox/examples/undeb
r821 r3621 6 6 # 7 7 usage() { 8 echo "Usage: undeb -c package.deb <Print control file info>" 9 echo " undeb -l package.deb <List contents of deb package>" 10 echo " undeb -x package.deb /foo/boo <Extract deb package to this directory," 11 echo " put . for current directory>" 12 exit 8 cat <<EOF 9 Usage: undeb -c package.deb <Print control file info> 10 undeb -l package.deb <List contents of deb package> 11 undeb -x package.deb /foo/boo <Extract deb package to this directory, 12 put . for current directory> 13 EOF 14 exit 13 15 } 14 16 … … 16 18 17 19 exist() { 18 if [ "$deb" = "" ]; then19 usage20 elif [ ! -s "$deb" ]; then21 echo "Can't find $deb!"22 exit 23 fi20 if [ -z "${deb}" ]; then 21 usage 22 elif [ ! -s "${deb}" ]; then 23 echo "Can't find ${deb}!" 24 exit 1 25 fi 24 26 } 25 27 26 if [ "$1" = "" ]; then27 usage28 if [ -z "$1" ]; then 29 usage 28 30 elif [ "$1" = "-l" ]; then 29 exist 30 type more >/dev/null 2>&1 && pager=more 31 type less >/dev/null 2>&1 && pager=less 32 [ "$pager" = "" ] && echo "No pager found!" && exit 33 (ar -p $deb control.tar.gz | tar -xzO *control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | tar -tzv) | $pager 34 exit 31 exist 32 type more >/dev/null 2>&1 && pager=more 33 type less >/dev/null 2>&1 && pager=less 34 [ -z "${pager}" ] && echo "No pager found!" && exit 1 35 ( 36 ar -p "${deb}" control.tar.gz | tar -xzO *control 37 printf "\nPress enter to scroll, q to Quit!\n\n" 38 ar -p "${deb}" data.tar.gz | tar -tzv 39 ) | ${pager} 40 exit 35 41 elif [ "$1" = "-c" ]; then 36 exist37 ar -p $debcontrol.tar.gz | tar -xzO *control38 exit42 exist 43 ar -p "${deb}" control.tar.gz | tar -xzO *control 44 exit 39 45 elif [ "$1" = "-x" ]; then 40 exist 41 if [ "$3" = "" ]; then 42 usage 43 elif [ ! -d "$3" ]; then 44 echo "No such directory $3!" 45 exit 46 exist 47 if [ -z "$3" ]; then 48 usage 49 elif [ ! -d "$3" ]; then 50 echo "No such directory $3!" 51 exit 1 52 fi 53 ar -p "${deb}" data.tar.gz | tar -xzvpf - -C "$3" || exit 54 echo 55 echo "Extracted ${deb} to $3!" 56 exit 57 else 58 usage 46 59 fi 47 ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit48 echo49 echo "Extracted $deb to $3!"50 exit51 else52 usage53 fi -
branches/3.3/mindi-busybox/examples/unrpm
r821 r3621 6 6 # 7 7 usage() { 8 echo "Usage: unrpm -l package.rpm <List contents of rpm package>" 9 echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory," 10 echo " put . for current directory>" 11 exit 8 cat <<EOF 9 Usage: unrpm -l package.rpm <List contents of rpm package> 10 unrpm -x package.rpm /foo/boo <Extract rpm package to this directory, 11 put . for current directory> 12 EOF 13 exit 12 14 } 13 15 … … 15 17 16 18 exist() { 17 if [ "$rpm" = "" ]; then18 usage19 elif [ ! -s "$rpm" ]; then20 echo "Can't find $rpm!"21 exit 22 fi19 if [ -z "${rpm}" ]; then 20 usage 21 elif [ ! -s "${rpm}" ]; then 22 echo "Can't find ${rpm}!" 23 exit 1 24 fi 23 25 } 24 26 25 if [ "$1" = "" ]; then26 usage27 if [ -z "$1" ]; then 28 usage 27 29 elif [ "$1" = "-l" ]; then 28 exist 29 type more >/dev/null 2>&1 && pager=more 30 type less >/dev/null 2>&1 && pager=less 31 [ "$pager" = "" ] && echo "No pager found!" && exit 32 (echo -e "\nPress enter to scroll, q to Quit!\n" ; rpm2cpio $rpm | cpio -tv --quiet) | $pager 33 exit 30 exist 31 type more >/dev/null 2>&1 && pager=more 32 type less >/dev/null 2>&1 && pager=less 33 [ "$pager" = "" ] && echo "No pager found!" && exit 34 ( 35 printf "\nPress enter to scroll, q to Quit!\n\n" 36 rpm2cpio "${rpm}" | cpio -tv --quiet 37 ) | ${pager} 38 exit 34 39 elif [ "$1" = "-x" ]; then 35 exist 36 if [ "$3" = "" ]; then 37 usage 38 elif [ ! -d "$3" ]; then 39 echo "No such directory $3!" 40 exit 40 exist 41 if [ -z "$3" ]; then 42 usage 43 elif [ ! -d "$3" ]; then 44 echo "No such directory $3!" 45 exit 1 46 fi 47 rpm2cpio "${rpm}" | (umask 0 ; cd "$3" ; cpio -idmuv) || exit 48 echo 49 echo "Extracted ${rpm} to $3!" 50 exit 51 else 52 usage 41 53 fi 42 rpm2cpio $rpm | (umask 0 ; cd $3 ; cpio -idmuv) || exit43 echo44 echo "Extracted $rpm to $3!"45 exit46 else47 usage48 fi -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/convert2ntpconf
r2725 r3621 30 30 for n in $ntpsrv; do 31 31 echo "let cfg=cfg+1" 32 echo "ntpip[\$cfg]='$n'" ;32 echo "ntpip[\$cfg]='$n'" 33 33 done 34 34 } >"$1" -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/dhcp_handler
r2725 r3621 37 37 file_ntpconf="$service.ntpconf" 38 38 dir_ipconf="/var/run/service/fw" 39 dir_ntpconf="/var/run/service/ntp "39 dir_ntpconf="/var/run/service/ntpd" 40 40 41 41 exec >/dev/null … … 48 48 # Reconfigure network with this interface disabled 49 49 echo "Deconfiguring" 50 rm " $service.out"50 rm "env.out" 51 51 rm "$file_ipconf" 52 52 rm "$file_ntpconf" … … 58 58 59 59 # Bound: we've got the lease 60 #env >"$service.out" # debug 60 # Record information for e.g. dhcp_$IF_pinger service 61 env >"env.out" 61 62 62 63 ./convert2ipconf "$file_ipconf" … … 70 71 fi 71 72 72 if test -d /var/service/ntp ; then73 if test -d /var/service/ntpd; then 73 74 ./convert2ntpconf "$file_ntpconf" 74 75 # Reconfigure ntp server addresses if needed … … 78 79 mkdir -p "$dir_ntpconf" 2>/dev/null 79 80 cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" 80 sv t /var/service/ntp 81 sv u /var/service/ntp 81 sv t /var/service/ntpd 82 sv u /var/service/ntpd 82 83 fi 83 84 fi -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/dhcp_if_pinger/run
r2725 r3621 1 1 #!/bin/sh 2 2 3 delay=67 4 3 # How often to test, seconds 4 ping_time=67 5 # "One ping, must have reply in 1 sec" 6 ping_opts="-c1 -W1 -w1" 7 # If ping failed, how soon to retry 8 retry_time=5 9 # Reinit after this many consecutive ping error 10 max_fail=5 11 # Interface whose DHCP data to use 5 12 if=${PWD##*/dhcp_} 6 13 if=${if%%_pinger} 14 15 msg() { 16 echo "`date '+%Y-%m-%d %H:%M:%S'` $*" >>"$0.log" 17 } 7 18 8 19 if test -f "$0.log"; then … … 11 22 fi 12 23 13 test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$delay" 14 . "/var/service/dhcp_$if/dhcp_$if.out" 15 test x"$router" != x"" || exec env - sleep "$delay" 24 test -f "/var/service/dhcp_$if/env.out" || exec env - sleep "$ping_time" 16 25 17 #echo "`date '+%Y-%m-%d %H:%M:%S'` Testing ping -c3 $router" >>"$0.log"18 ping -c3 "$router" && exec env - sleep "$delay"26 . "/var/service/dhcp_$if/env.out" 27 test x"$router" != x"" || exec env - sleep "$ping_time" 19 28 20 echo "`date '+%Y-%m-%d %H:%M:%S'` Restarting /var/service/dhcp_$if" >>"$0.log" 21 sv t "/var/service/dhcp_$if" 29 #msg "Pinging $router" 30 failcnt=0 31 while true; do 32 ping $ping_opts "$router" && exec env - sleep "$ping_time" 33 : $((failcnt++)) 34 msg "Failed to ping $router, fail count:$failcnt" 35 test $failcnt -ge $max_fail && break 36 env - sleep "$retry_time" 37 done 22 38 23 exec env - sleep "$delay" 39 test -d "/var/service/dhcp_$if" && { 40 msg "Restarting /var/service/dhcp_$if" 41 sv t "/var/service/dhcp_$if" 42 } 43 test -d "/var/service/supplicant_$if" && { 44 msg "Restarting /var/service/supplicant_$if" 45 sv t "/var/service/supplicant_$if" 46 } 47 exec env - sleep "$ping_time" -
branches/3.3/mindi-busybox/examples/var_service/ftpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/fw/run
r2725 r3621 63 63 # Make sure rundir/ exists 64 64 mkdir -p "$rundir" 2>/dev/null 65 chown -R "$user :""$rundir"65 chown -R "$user": "$rundir" 66 66 chmod -R a=rX "$rundir" 67 67 rm -rf rundir 2>/dev/null -
branches/3.3/mindi-busybox/examples/var_service/httpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ifplugd_if/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ifplugd_if/run
r2725 r3621 8 8 9 9 if="${PWD##*/ifplugd_}" 10 11 echo "* Upping iface $if" 12 ip link set dev "$if" up 10 13 11 14 echo "* Starting ifplugd on $if [$$]" -
branches/3.3/mindi-busybox/examples/var_service/inetd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ntpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11 -
branches/3.3/mindi-busybox/examples/var_service/ntpd/ntp.script
r2725 r3621 11 11 dt=`date '+%Y-%m-%d %H:%M:%S'` 12 12 13 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$" 14 15 if test x"$1" = x"unsync" \ 16 ; then 17 # No replies for our NTP requests were seen for some time. 18 # 19 # Among more mundate cases like network outages, this happens 20 # if we ran for a LONG time (days) and ntp server's IP has changed. 21 # ntpd has no code to re-resolve peers' addresses to IPs, 22 # we need to help it: 23 # 24 echo "$dt: $1"\ 25 "syncronization lost, restarting ntpd"\ 26 >>"$0.log.$$" 27 mv -- "$0.log.$$" "$0.log" 28 kill $PPID 29 exit 30 fi 31 13 32 if test x"$stratum" != x"" \ 14 33 && test x"$poll_interval" != x"" \ … … 16 35 && test 128 -le "$poll_interval" \ 17 36 ; then 18 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"19 37 echo "$dt: $1"\ 20 38 "freq_drift_ppm=$freq_drift_ppm"\ … … 28 46 fi 29 47 30 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"31 48 echo "$dt: $1"\ 32 49 "freq_drift_ppm=$freq_drift_ppm"\ -
branches/3.3/mindi-busybox/examples/var_service/ntpd/run
r2725 r3621 16 16 # Make sure rundir/ exists 17 17 mkdir -p "$rundir" 2>/dev/null 18 chown -R "$user :""$rundir"18 chown -R "$user": "$rundir" 19 19 chmod -R a=rX "$rundir" 20 20 rm -rf rundir 2>/dev/null -
branches/3.3/mindi-busybox/examples/var_service/tftpd/log/run
r2725 r3621 7 7 chown -R "$user": "$logdir" 8 8 chmod -R go-rwxst,u+rwX "$logdir" 9 rm logdir9 rm -rf logdir 10 10 ln -s "$logdir" logdir 11 11
Note:
See TracChangeset
for help on using the changeset viewer.