Advertisement
s243a

initrd/init:find_save_file() - tahrpup LN#713-740

Apr 24th, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.20 KB | None | 0 0
  1. # LN# 713 to 740 of /initrd/init (tahrpup) - http://www.pearltrees.com/s243a/initrd-init/id19535893/item224274990
  2. # LN# 765 to 800 https://github.com/puppylinux-woof-CE/woof-CE/blob/c96d661c2232caef1d69c693de673fb0e54796f8/initrd-progs/0initrd/init#L765
  3. find_save_file() {
  4. # "$1" - mount point - ex:  /mnt/pdrv
  5. # "$2" - partition name - ex: sdb2
  6. # "$3" - file system type - ex: ext4
  7.  if [ "$SAVE_BP_DIR" ];then
  8.   SAVE_DIR="$SAVE_BP_DIR"
  9.  else
  10.   SAVE_DIR="${PSUBDIR}/"
  11.  fi
  12.  SAVE_FILES="$(ls -d ${1}${SAVE_DIR}${DISTRO_FILE_PREFIX}save* 2>/dev/null)"
  13.  for ONE_SAVE in $SAVE_FILES;do
  14.   #validate savefiles here
  15.   [ "$ONE_FS_IS_LINUX" != "yes" ] && [ -d "$ONE_SAVE" ] && continue
  16.   IS_OK=""
  17.   case $ONE_SAVE in
  18.    *.2fs|*.3fs|*.4fs) [ -s "$ONE_SAVE" ] && IS_OK="yes" ;;
  19.    *.BKP-*) IS_OK="$PSAVEBKP" ;; #written by /usr/sbin/pupsave-backup
  20.    *) [ -d "$ONE_SAVE" ] && IS_OK="yes" ;;
  21.   esac
  22.   [ "$IS_OK" ] && PUP_SAVES="${PUP_SAVES}${2},${3},${SAVE_DIR}$(basename $ONE_SAVE)
  23. "
  24.  done
  25.  PUP_SAVES="$(echo "$PUP_SAVES")" #remove trailing newline char
  26.  echo "MENU_MAX_PUPSAVES=${MENU_MAX_PUPSAVES}" #debug
  27.  if [ "$MENU_MAX_PUPSAVES" ] ; then
  28.    PUP_SAVES="$(echo "$PUP_SAVES" | head -n $MENU_MAX_PUPSAVES)"
  29.  fi
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement