Skip to content

Commit

Permalink
autodelete old swap.img file from old fws
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninoh-FOX authored Dec 2, 2019
1 parent b7a0abe commit 3c729ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rootfs/etc/init.d/S99swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [ -z "$1" ] || [ "x$1" = "xstart" ]; then
# Swap to SD card.
size=$(( $SWAP_SD_SIZE_MB * 1024 ))
if [ $size -ne 0 ]; then
if [ -r $SWAP_SD_FILE ]; then
if [[ -r $SWAP_SD_FILE && -f /media/data/.swapon ]]; then
/sbin/swapon -p$SWAP_SD_PRIORITY $SWAP_SD_FILE
else
echo -n 1 >/sys/devices/virtual/vtconsole/vtcon1/bind
Expand All @@ -32,13 +32,14 @@ if [ -z "$1" ] || [ "x$1" = "xstart" ]; then
echo "Make SWAP file for fist time, please wait..."
echo
dd if=/dev/zero bs=1024 | pv -s 498M | dd of=$SWAP_SD_FILE bs=1024 count=$size conv=notrunc,noerror
echo "done"
sleep 2
echo -n 0 >/sys/devices/virtual/vtconsole/vtcon1/bind
chown root:root $SWAP_SD_FILE
chmod 0600 $SWAP_SD_FILE
/sbin/mkswap $SWAP_SD_FILE
/sbin/swapon -p$SWAP_SD_PRIORITY $SWAP_SD_FILE
echo "done"
sleep 2
echo -n 0 >/sys/devices/virtual/vtconsole/vtcon1/bind
touch /media/data/.swapon
fi
fi
fi
Expand Down

0 comments on commit 3c729ce

Please sign in to comment.