Reworked cleaning logic
This commit is contained in:
parent
17743874c3
commit
e099527769
@ -13,8 +13,9 @@
|
||||
# method
|
||||
KERNEL_ONLY="no" # build only kernel
|
||||
KERNEL_CONFIGURE="no" # want to change my default configuration
|
||||
CLEAN_LEVEL="" # 0 = make clean + del debs, 1 = only make clean, 2 = nothing
|
||||
# 3 = choosing kernel if present 4 = del all output
|
||||
CLEAN_LEVEL="make,debs" # comma-sparated list of clean targets: "make" = make clean for selected kernel and u-boot,
|
||||
# "images" = delete "./output/images", "debs" = delete "./output/debs",
|
||||
# "cache" = delete "./output/cache", "sources" = delete "./sources"
|
||||
# user
|
||||
AFTERINSTALL="" # last command before closing image, example: apt-get install joe
|
||||
DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
|
||||
@ -90,4 +91,4 @@ fi
|
||||
|
||||
# If you are committing new version of this file, increment VERSION
|
||||
# Only integers are supported
|
||||
# VERSION=3
|
||||
# VERSION=4
|
||||
|
||||
89
general.sh
89
general.sh
@ -10,64 +10,45 @@
|
||||
#
|
||||
|
||||
|
||||
# cleaning <#>
|
||||
# 0 = make clean + del debs
|
||||
# 1 = only make clean
|
||||
# 2 = nothing
|
||||
# 3 = choosing kernel if present
|
||||
# 4 = del all output and sources
|
||||
|
||||
# cleaning <target>
|
||||
#
|
||||
# target: what to clean
|
||||
# "make" - "make clean" for selected kernel and u-boot
|
||||
# "debs" - delete output/debs
|
||||
# "cache" - delete output/cache
|
||||
# "images" - delete output/images
|
||||
# "sources" - delete output/sources
|
||||
#
|
||||
cleaning()
|
||||
{
|
||||
case $1 in
|
||||
1) # Clean u-boot and kernel sources
|
||||
if [ -d "$SOURCES/$BOOTSOURCEDIR" ]; then
|
||||
display_alert "Cleaning" "$SOURCES/$BOOTSOURCEDIR" "info"
|
||||
cd $SOURCES/$BOOTSOURCEDIR
|
||||
make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
fi
|
||||
|
||||
[ -d "$SOURCES/$LINUXSOURCEDIR" ] && display_alert "Cleaning" "$SOURCES/$LINUXSOURCEDIR" "info" && cd $SOURCES/$LINUXSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
[ -f $DEST/cache/building/$HEADERS_CACHE.tgz ] && display_alert "Cleaning" "$HEADERS_CACHE.tgz" "info" && rm -f $DEST/cache/building/$HEADERS_CACHE.tgz
|
||||
|
||||
;;
|
||||
2) display_alert "No cleaning" "sources" "info"
|
||||
;;
|
||||
3) # Choosing kernel if debs are present
|
||||
if [[ $BRANCH == "next" ]]; then
|
||||
MYARRAY=($(ls -1 $DEST/debs/linux-image* | awk '/next/' | sed ':a;N;$!ba;s/\n/;/g'))
|
||||
else
|
||||
MYARRAY=($(ls -1 $DEST/debs/linux-image* | awk '!/next/' | sed ':a;N;$!ba;s/\n/;/g'))
|
||||
fi
|
||||
if [[ ${#MYARRAY[@]} != "0" && $KERNEL_ONLY != "yes" ]]; then choosing_kernel; fi
|
||||
;;
|
||||
4) # Delete all in output except repository
|
||||
display_alert "Removing deb packages" "$DEST/debs/" "info"
|
||||
rm -rf $DEST/debs
|
||||
display_alert "Removing root filesystem cache" "$DEST/cache" "info"
|
||||
rm -rf $DEST/cache
|
||||
display_alert "Removing SD card images" "$DEST/images" "info"
|
||||
rm -rf $DEST/images
|
||||
display_alert "Removing sources" "$DEST/images" "info"
|
||||
rm -rf $SOURCES
|
||||
;;
|
||||
*) # Clean u-boot and kernel sources and remove debs
|
||||
[ -d "$SOURCES/$BOOTSOURCEDIR" ] &&
|
||||
display_alert "Cleaning" "$SOURCES/$BOOTSOURCEDIR" "info" && cd $SOURCES/$BOOTSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
[ -f "$DEST/debs/$CHOOSEN_UBOOT" ] &&
|
||||
display_alert "Removing" "$DEST/debs/$CHOOSEN_UBOOT" "info" && rm $DEST/debs/$CHOOSEN_UBOOT
|
||||
[ -d "$SOURCES/$LINUXSOURCEDIR" ] &&
|
||||
display_alert "Cleaning" "$SOURCES/$LINUXSOURCEDIR" "info" && cd $SOURCES/$LINUXSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
[ -f "$DEST/debs/$CHOOSEN_KERNEL" ] &&
|
||||
display_alert "Removing" "$DEST/debs/$CHOOSEN_KERNEL" "info" && rm $DEST/debs/$CHOOSEN_KERNEL
|
||||
[ -f $DEST/cache/building/$HEADERS_CACHE.tgz ] && display_alert "Cleaning" "$HEADERS_CACHE.tgz" "info" && rm -f $DEST/cache/building/$HEADERS_CACHE.tgz
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
"make") # clean u-boot and kernel sources
|
||||
[ -d "$SOURCES/$BOOTSOURCEDIR" ] && display_alert "Cleaning" "$SOURCES/$BOOTSOURCEDIR" "info" && cd $SOURCES/$BOOTSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
[ -d "$SOURCES/$LINUXSOURCEDIR" ] && display_alert "Cleaning" "$SOURCES/$LINUXSOURCEDIR" "info" && cd $SOURCES/$LINUXSOURCEDIR && make -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
|
||||
;;
|
||||
|
||||
"debs") # delete output/debs
|
||||
[ -d "$DEST/debs" ] && display_alert "Cleaning" "$DEST/debs" "info" && rm -rf $DEST/debs
|
||||
;;
|
||||
|
||||
"cache") # delete output/cache
|
||||
[ -d "$DEST/cache" ] && display_alert "Cleaning" "$DEST/cache" "info" && rm -rf $DEST/cache
|
||||
;;
|
||||
|
||||
"images") # delete output/images
|
||||
[ -d "$DEST/images" ] && display_alert "Cleaning" "$DEST/images" "info" && rm -rf $DEST/images
|
||||
;;
|
||||
|
||||
"sources") # delete output/sources
|
||||
[ -d "$SOURCES" ] && display_alert "Cleaning" "$SOURCES" "info" && rm -rf $SOURCES
|
||||
;;
|
||||
|
||||
*) # unknown
|
||||
display_alert "Cleaning: unrecognized option" "$1" "wrn"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# fetch_from_github <URL> <directory> <tag> <tagsintosubdir>
|
||||
#
|
||||
# parameters:
|
||||
|
||||
15
main.sh
15
main.sh
@ -265,7 +265,7 @@
|
||||
# Some old branches are tagged
|
||||
#if [ "$BRANCH" == "default" ]; then KERNELTAG="$LINUXBRANCH"; fi
|
||||
|
||||
[[ "$CLEAN_LEVEL" == "4" ]] && cleaning "$CLEAN_LEVEL"
|
||||
[[ "$CLEAN_LEVEL" == *sources* ]] && cleaning "sources"
|
||||
|
||||
display_alert "source downloading" "@host" "info"
|
||||
fetch_from_github "$BOOTLOADER" "$BOOTSOURCE" "$BOOTBRANCH" "yes"
|
||||
@ -295,8 +295,17 @@
|
||||
CHOOSEN_ROOTFS=linux-"$RELEASE"-root"$branch"-"$BOARD"_"$REVISION"_armhf
|
||||
HEADERS_CACHE="${CHOOSEN_KERNEL/image/cache}"
|
||||
|
||||
# cleaning level 0,1,2,3
|
||||
[[ "$CLEAN_LEVEL" != "4" ]] && cleaning "$CLEAN_LEVEL"
|
||||
# Choosing kernel if debs are present
|
||||
#if [[ $BRANCH == "next" ]]; then
|
||||
# MYARRAY=($(ls -1 $DEST/debs/linux-image* | awk '/next/' | sed ':a;N;$!ba;s/\n/;/g'))
|
||||
# else
|
||||
# MYARRAY=($(ls -1 $DEST/debs/linux-image* | awk '!/next/' | sed ':a;N;$!ba;s/\n/;/g'))
|
||||
#fi
|
||||
#if [[ ${#MYARRAY[@]} != "0" && $KERNEL_ONLY != "yes" ]]; then choosing_kernel; fi
|
||||
|
||||
for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do
|
||||
[ "$option" != "sources" ] && cleaning "$option"
|
||||
done
|
||||
|
||||
# patching sources
|
||||
patching_sources
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user