From f854afaba1005dbb7ede91e180abb0e9c800cbd8 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Thu, 19 Dec 2019 10:56:18 -0700 Subject: armbian: fix distro build Signed-off-by: nachoparker --- .gitignore | 1 + armbian.sh | 1 + batch.sh | 7 ++++++- build-SD-armbian.sh | 21 +++++++++++++-------- build-SD-berryboot.sh | 5 +++-- build-SD-rpi.sh | 6 ++++-- build-VM.sh | 6 ++++-- buildlib.sh | 15 +++++++++++++++ config-bananapi.conf | 5 ----- config-odroidxu4.conf | 2 +- 10 files changed, 48 insertions(+), 21 deletions(-) delete mode 100644 config-bananapi.conf diff --git a/.gitignore b/.gitignore index da3509e3..5124aef2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .*.swp qemu-raspbian-network/ +archive/ output/ cache/ torrent/ diff --git a/armbian.sh b/armbian.sh index 5390bdf7..b594d28e 100644 --- a/armbian.sh +++ b/armbian.sh @@ -37,6 +37,7 @@ cp etc/ncp-config.d/nc-nextcloud.cfg /usr/local/etc/ncp-config.d/ cp etc/library.sh /usr/local/etc/ cp etc/ncp.cfg /usr/local/etc/ +hostname -F /etc/hostname # fix 'sudo resolve host' errors install_app lamp.sh install_app bin/ncp/CONFIG/nc-nextcloud.sh run_app_unsafe bin/ncp/CONFIG/nc-nextcloud.sh diff --git a/batch.sh b/batch.sh index 97b4c286..e1990a99 100755 --- a/batch.sh +++ b/batch.sh @@ -17,9 +17,14 @@ source buildlib.sh # initializes $IMGNAME [[ "$FTPPASS" == "" ]] && { echo -e "\e[1mNo FTPPASS variable found, FTP won't work.\nYou can ^C to cancel now\e[0m" - sleep 5 } +[[ "$CLEAN" != "0" ]] && { + echo -e "\e[1mNOTE: CLEAN is enabled\nYou can ^C to cancel now\e[0m" +} + +sleep 5 + # Raspbian ./build-SD-rpi.sh IMG="$( ls -1t tmp/*.img | head -1 )" diff --git a/build-SD-armbian.sh b/build-SD-armbian.sh index 6af6d872..58b9be0e 100755 --- a/build-SD-armbian.sh +++ b/build-SD-armbian.sh @@ -15,6 +15,9 @@ NCPCFG=etc/ncp.cfg IMG="NextCloudPi_${BNAME}_$( date "+%m-%d-%y" ).img" IMG=tmp/"$IMG" +TAR=output/"$( basename "$IMG" .img ).tar.bz2" + +test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; } set -e source buildlib.sh @@ -34,35 +37,37 @@ rsync -Aax --delete --exclude-from .gitignore --exclude *.img --exclude *.bz2 . # GENERATE IMAGE +CONF=armbian/userpatches/config-ncp.conf + # default parameters -cat > armbian/config-docker-guest.conf < "$CONF" <> armbian/config-docker-guest.conf <> "$CONF" <> armbian/config-docker-guest.conf +EXTRA_CONF="config-$BOARD".conf +[[ -f "$EXTRA_CONF" ]] && cat "$EXTRA_CONF" >> "$CONF" # build rm -rf armbian/output/images -armbian/compile.sh docker -rm armbian/config-docker-guest.conf +armbian/compile.sh docker ncp +rm "$CONF" # pack image mv armbian/output/images/Armbian*.img "$IMG" -TAR=output/"$( basename "$IMG" .img ).tar.bz2" pack_image "$IMG" "$TAR" # test diff --git a/build-SD-berryboot.sh b/build-SD-berryboot.sh index 10decd60..4857902d 100755 --- a/build-SD-berryboot.sh +++ b/build-SD-berryboot.sh @@ -10,10 +10,13 @@ SRC="$1" IMG="NextCloudPi_RPi_Berryboot_$( date "+%m-%d-%y" ).img" +TAR=output/"$( basename "$IMG" .img ).tar.bz2" set -e source buildlib.sh +test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; } + [[ -f "$SRC" ]] || { echo "$SRC not found"; exit 1; } # convert to Berryboot @@ -30,8 +33,6 @@ sudo mksquashfs raspbian_root "$IMG" -comp lzo -e lib/modules umount_raspbian ## pack - -TAR=output/"$( basename "$IMG" .img ).tar.bz2" pack_image "$IMG" "$TAR" # upload diff --git a/build-SD-rpi.sh b/build-SD-rpi.sh index d4195ebd..d13cc70b 100755 --- a/build-SD-rpi.sh +++ b/build-SD-rpi.sh @@ -14,15 +14,18 @@ source buildlib.sh SIZE=3G # Raspbian image size #CLEAN=0 # Pass this envvar to skip cleaning download cache IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img" +TAR=output/"$( basename "$IMG" .img ).tar.bz2" ############################################################################## +test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; } pgrep -f qemu-arm-static &>/dev/null && { echo "qemu-arm-static already running. Abort"; exit 1; } ## preparations IMG=tmp/"$IMG" +trap clean_chroot_raspbian EXIT prepare_dirs # tmp cache output download_raspbian "$IMG" resize_image "$IMG" "$SIZE" @@ -94,11 +97,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ mv /ld.so.preload /etc EOFCHROOT +trap '' EXIT clean_chroot_raspbian ## pack - -TAR=output/"$( basename "$IMG" .img ).tar.bz2" pack_image "$IMG" "$TAR" ## test diff --git a/build-VM.sh b/build-VM.sh index a0bcbdbc..656db373 100755 --- a/build-VM.sh +++ b/build-VM.sh @@ -15,6 +15,9 @@ IP=${1:-192.168.0.145} # For QEMU automated testing (optional) SIZE=3G # Raspbian image size #CLEAN=0 # Pass this envvar to skip cleaning download cache IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img" +TAR=output/"$( basename "$IMG" .img ).tar.bz2" + +test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; } ############################################################################## @@ -24,6 +27,7 @@ IMG="NextCloudPi_VM_$( date "+%m-%d-%y" ).img" IMG=tmp/"$IMG" VM="/var/lib/libvirt/images/nextcloudpi_default.img" +test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; } set -e prepare_dirs # tmp cache output @@ -41,8 +45,6 @@ sudo chown "$USER" "$VM" sudo cp -a --reflink=auto --sparse=auto "$VM" "$IMG" ## pack - -TAR=output/"$( basename "$IMG" .img ).tar.bz2" pack_image "$IMG" "$TAR" ## test diff --git a/buildlib.sh b/buildlib.sh index 2d2bc4fe..c7464d5c 100644 --- a/buildlib.sh +++ b/buildlib.sh @@ -361,6 +361,21 @@ EOF cd - } +upload_all() +{ + test -d output || { echo "No uploads found. Nothing to do"; return; } + [[ "$FTPPASS" == "" ]] && { + echo -e "\e[1mNo FTPPASS variable found, FTP won't work.\nYou can ^C to cancel now\e[0m" + sleep 5 + } + + mkdir -p archive + for img in $(find output -name '*.tar.bz2'); do + upload_ftp "${img}" && mv "${img}" archive + done +} + + function test_image() { local IMG="$1" diff --git a/config-bananapi.conf b/config-bananapi.conf deleted file mode 100644 index 8f7d3a22..00000000 --- a/config-bananapi.conf +++ /dev/null @@ -1,5 +0,0 @@ -# -# Place here configuration options that differ from standard NCP build options -# - -BRANCH=next diff --git a/config-odroidxu4.conf b/config-odroidxu4.conf index 8f7d3a22..38e1a2d0 100644 --- a/config-odroidxu4.conf +++ b/config-odroidxu4.conf @@ -2,4 +2,4 @@ # Place here configuration options that differ from standard NCP build options # -BRANCH=next +BRANCH=dev -- cgit v1.2.3