Implement old rootfs cache files clean up option

This commit is contained in:
zador-blood-stained 2017-01-21 16:02:22 +03:00
parent 4f5acd13cf
commit 9b232d73ba
4 changed files with 12 additions and 6 deletions

View file

@ -32,7 +32,6 @@ mkdir -p /run/armbian
RELEASE_LIST=("xenial" "jessie") RELEASE_LIST=("xenial" "jessie")
BRANCH_LIST=("default" "next" "dev") BRANCH_LIST=("default" "next" "dev")
pack_upload () pack_upload ()
{ {
# pack into .7z and upload to server # pack into .7z and upload to server
@ -66,7 +65,6 @@ while ! rsync -arP $CACHEDIR/$DESTIMG/. -e 'ssh -p 22' ${SEND_TO_SERVER}:/var/ww
rm -r $CACHEDIR/$DESTIMG" & rm -r $CACHEDIR/$DESTIMG" &
} }
build_main () build_main ()
{ {
touch "/run/armbian/Armbian_${BOARD^}_${BRANCH}_${RELEASE}_${BUILD_DESKTOP}.pid"; touch "/run/armbian/Armbian_${BOARD^}_${BRANCH}_${RELEASE}_${BUILD_DESKTOP}.pid";

View file

@ -15,10 +15,11 @@
KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
KERNEL_CONFIGURE="no" # change provided kernel configuration KERNEL_CONFIGURE="no" # change provided kernel configuration
CLEAN_LEVEL="make,debs" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot, CLEAN_LEVEL="make,debs,oldcache" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot,
# "debs" = delete packages in "./output/debs" for current branch and family, # "debs" = delete packages in "./output/debs" for current branch and family,
# "alldebs" - delete all packages in "./output/debs", "images" = delete "./output/images", # "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images",
# "cache" = delete "./output/cache", "sources" = delete "./sources" # "cache" = delete "./output/cache", "sources" = delete "./sources"
# "oldcache" = remove old cached rootfs except for the newest 6 files
DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8 DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8

View file

@ -59,7 +59,7 @@ cleaning()
;; ;;
cache) # delete output/cache cache) # delete output/cache
[[ -d $CACHEDIR ]] && display_alert "Cleaning" "output/cache" "info" && find $CACHEDIR/ -type f -delete [[ -d $CACHEDIR ]] && display_alert "Cleaning" "output/cache/rootfs (all)" "info" && find $CACHEDIR/rootfs/ -type f -delete
;; ;;
images) # delete output/images images) # delete output/images
@ -69,6 +69,13 @@ cleaning()
sources) # delete output/sources and output/buildpkg sources) # delete output/sources and output/buildpkg
[[ -d $SOURCES ]] && display_alert "Cleaning" "sources" "info" && rm -rf $SOURCES/* $DEST/buildpkg/* [[ -d $SOURCES ]] && display_alert "Cleaning" "sources" "info" && rm -rf $SOURCES/* $DEST/buildpkg/*
;; ;;
oldcache)
if [[ -d $CACHEDIR/rootfs/ && $(ls -1 $CACHEDIR/rootfs/ | wc -l) -gt 6 ]]; then
display_alert "Cleaning" "output/cache/rootfs (old)" "info"
(cd $CACHEDIR/rootfs/; ls -t | sed -e "1,6d" | xargs -d '\n' rm -f)
fi
;;
esac esac
} }

View file

@ -49,7 +49,7 @@ date +"%d_%m_%Y-%H_%M_%S" > $DEST/debug/timestamp
# compile.sh version checking # compile.sh version checking
ver1=$(awk -F"=" '/^# VERSION/ {print $2}' <$SRC/compile.sh ) ver1=$(awk -F"=" '/^# VERSION/ {print $2}' <$SRC/compile.sh )
ver2=$(awk -F"=" '/^# VERSION/ {print $2}' <$SRC/lib/compile.sh 2>/dev/null) || ver2=0 ver2=$(awk -F"=" '/^# VERSION/ {print $2}' <$SRC/lib/compile.sh 2>/dev/null) || ver2=0
if [[ -z $ver1 || $ver1 -lt $ver2 ]]; then if [[ $BETA != yes && ( -z $ver1 || $ver1 -lt $ver2 ) ]]; then
display_alert "File $0 is outdated. Please overwrite it with an updated version from" "$SRC/lib" "wrn" display_alert "File $0 is outdated. Please overwrite it with an updated version from" "$SRC/lib" "wrn"
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue" echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
read read