Advertisement
s243a

/usr/bin/fix_initrd

Jul 20th, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | None | 0 0
  1. #!/bin/sh
  2. . /etc/rc.d/PUPSTATE
  3. SAVE_REL="$(echo $PUPSAVE | cut -d',' -f3)"
  4. SAVE_PATH="/initrd/mnt/dev_save$SAVE_REL"
  5. RW_PATH="/initrd/mnt/tmpfs$RW_LAYER"
  6.  
  7. if [ -d "$SAVE_PATH/initrd/pup_ro1" ]; then
  8.      cp -arfv --remove-destination "$SAVE_PATH/initrd/pup_ro1" "$SAVE_PATH"
  9.      rm -rf /initrd/pup_ro1  
  10. fi
  11. if [ "$(realpath /initrd/pup_ro1)" != "$(realpath "$SAVE_PATH")" ]; then
  12.   if [ -d /initrd/pup_ro1 ] && [ ! -L /initrd/pup_ro1 ]; then
  13.      cp -arfv --remove-destination /initrd/pup_ro1 "$SAVE_PATH"
  14.      rm -rf /initrd/pup_ro1  
  15.      ln -sv "$SAVE_PATH" /initrd/pup_ro1 #for after switch
  16.   elif [ ! -e /initrd/pup_ro1 ]; then
  17.     ln -sv "$SAVE_PATH" /initrd/pup_ro1 #for after switch
  18.   fi
  19. fi
  20. if [ ! -e "/initrd/pup_rw" ]; then
  21.   ln -sv  "$RW_PATH" "/initrd/pup_rw"
  22. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement