stali-init

Stali init files. To be shared.
git clone git://r-36.net/stali-init
Log | Files | Refs

rc.shutdown (828B)


      1 #!/bin/busybox ash
      2 
      3 . /etc/rc.conf
      4 
      5 # avoid staircase effect
      6 stty onlcr
      7 
      8 printf "Shutting down.\n"
      9 
     10 [ -x /bin/rc.local.shutdown ] && /bin/rc.local.shutdown
     11 
     12 svc -k 2>&1 >/dev/null
     13 
     14 printf "Saving random seed for next boot.\n"
     15 RANDOM_SEED=/var/lib/misc/random-seed
     16 touch $RANDOM_SEED
     17 chmod 600 $RANDOM_SEED
     18 POOL_FILE=/proc/sys/kernel/random/poolsize
     19 [ -r $POOL_FILE ] && POOL_SIZE=$(cat $POOL_FILE) || POOL_SIZE=512
     20 dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &>/dev/null
     21 
     22 printf "Halting.\n"
     23 halt -w
     24 
     25 [ "$USELVM" = "yes" ] && printf "Stopping lvm monitor.\n" && env vgchange --monitor n
     26 
     27 printf "Swapoff.\n"
     28 swapoff -a &>/dev/null
     29 printf "Unmounting all filesystems.\n"
     30 umount -a -r &>/dev/null
     31 
     32 # TODO: crypttab support
     33 
     34 [ "$USELVM" = "yes" ] && printf "Stopping lvm completely.\n" && env vgchange --sysinit -a n
     35