Refactor rootfs cache file number limit
This commit is contained in:
parent
5bf532726c
commit
57c98073b7
@ -20,6 +20,7 @@ EXIT_PATCHING_ERROR="" # exit patching if failed
|
||||
HOST="$(echo "$BOARD" | cut -f1 -d-)" # set hostname to the board
|
||||
ROOTFSCACHE_VERSION=3
|
||||
[[ -z $DISPLAY_MANAGER ]] && DISPLAY_MANAGER=nodm
|
||||
ROOTFS_CACHE_MAX=8 # max number of rootfs cache, older ones will be cleaned up
|
||||
|
||||
[[ -z $ROOTFS_TYPE ]] && ROOTFS_TYPE=ext4 # default rootfs type is ext4
|
||||
[[ "ext4 f2fs btrfs nfs fel" != *$ROOTFS_TYPE* ]] && exit_with_error "Unknown rootfs type" "$ROOTFS_TYPE"
|
||||
|
||||
@ -71,7 +71,7 @@ cleaning()
|
||||
oldcache)
|
||||
if [[ -d $SRC/cache/rootfs && $(ls -1 $SRC/cache/rootfs | wc -l) -gt 6 ]]; then
|
||||
display_alert "Cleaning" "rootfs cache (old)" "info"
|
||||
(cd $SRC/cache/rootfs; ls -t | sed -e "1,6d" | xargs -d '\n' rm -f)
|
||||
(cd $SRC/cache/rootfs; ls -t | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Loading…
Reference in New Issue
Block a user