Advertisement
s243a

rc.sysinit:loadswap_func()

Sep 7th, 2016
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.93 KB | None | 0 0
  1. ##lines 123 to 149 of /etc/rc.d/rc.sysinit
  2. ## http://www.pearltrees.com/s243a/rc-sysinit-puppylinux/id16200212
  3. loadswap_func() { #w481 made into a function.
  4.  echo "LOAD SWAP"
  5.  #load a swap partition...
  6.  for ONESWAP in `fdisk -l | grep ' Linux swap' | cut -f 1 -d ' ' | tr '\n' ' '`
  7.  do
  8.   echo -n "Loading swap partition $ONESWAP..." >/dev/console #loading swap partition
  9.   swapon $ONESWAP
  10.   status_func $?
  11.   [ $? -eq 0 ] && SWAPON="yes"
  12.  done
  13.  #if no go, try for a swap file...
  14.  if [ "$SWAPON" != "yes" ];then
  15.   SWAPFILE="/pupswap.swp"
  16.   if [ -f /initrd${PUP_HOME}${SWAPFILE} ];then
  17.    echo -n "Loading swap file ${SWAPFILE}..." >/dev/console #loading swap file
  18.    swapon /initrd${PUP_HOME}${SWAPFILE}
  19.    status_func $?
  20.    [ $? -eq 0 ] && SWAPON="yes"
  21.   fi
  22.   if [ -f $SWAPFILE ];then
  23.    echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
  24.    swapon $SWAPFILE
  25.    status_func $?
  26.    [ $? -eq 0 ] && SWAPON="yes"
  27.   fi
  28.  fi
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement