diff --git a/.gitignore b/.gitignore index 9c7fc90e7..51496aaad 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ ubuntu-*-cloudimg-console.log ### to ignore changes in a working copy .ignore_changes +### compile configurations added by users +/config-*.conf + ### output directories /.tmp/ /output/ diff --git a/compile.sh b/compile.sh index 967704b2c..f2b719bbe 100755 --- a/compile.sh +++ b/compile.sh @@ -8,43 +8,13 @@ # # This file is a part of tool chain https://github.com/igorpecovnik/lib # -#-------------------------------------------------------------------------------------------------------------------------------- - -# Read build script documentation http://www.armbian.com/using-armbian-tools/ -# for detailed explanation of these options and for additional options not listed here - -KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt -KERNEL_CONFIGURE="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt -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, - # "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images", - # "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 - -# advanced -KERNEL_KEEP_CONFIG="no" # do not overwrite kernel config before compilation -EXTERNAL="yes" # build and install extra applications and drivers -EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages -CREATE_PATCHES="no" # wait that you make changes to uboot and kernel source and creates patches -BUILD_ALL="no" # cycle through available boards and make images or kernel/u-boot packages. - # set KERNEL_ONLY to "yes" or "no" to build all packages/all images - -BSPFREEZE="" # freeze armbian packages (u-boot, kernel, dtb) - -# build script version to use -LIB_TAG="" # empty for latest version, - # one of listed here: https://github.com/igorpecovnik/lib/tags for stable versions, - # or commit hash -#-------------------------------------------------------------------------------------------------------------------------------- SRC=$(dirname $(realpath ${BASH_SOURCE})) # fallback for Trusty [[ -z $SRC ]] && SRC=$(pwd) cd $SRC -if [[ -f $SRC/lib/general.sh ]]; then +if [[ -f $SRC/lib/general.sh && -L $SRC/main.sh ]]; then source $SRC/lib/general.sh else echo "Error: missing build directory structure" @@ -52,6 +22,18 @@ else exit -1 fi +# copy default config from the template +[[ ! -f $SRC/config-default.conf ]] && cp $SRC/config/templates/config-example.conf $SRC/config-default.conf + +# source build configuration file +if [[ -n $1 && -f $SRC/config-$1.conf ]]; then + display_alert "Using config file" "config-$1.conf" "info" + source $SRC/config-$1.conf +else + display_alert "Using config file" "config-default.conf" "info" + source $SRC/config-default.conf +fi + if [[ $EUID != 0 ]]; then display_alert "This script requires root privileges, trying to use sudo" "" "wrn" sudo "$SRC/compile.sh" "$@" @@ -71,9 +53,6 @@ if [[ ! -f $SRC/.ignore_changes ]]; then fi fi -# source additional configuration file -[[ -n $1 && -f $SRC/config-$1.conf ]] && source $SRC/config-$1.conf - if [[ $BUILD_ALL == yes || $BUILD_ALL == demo ]]; then source $SRC/lib/build-all.sh else diff --git a/config/templates/config-example.conf b/config/templates/config-example.conf new file mode 100644 index 000000000..9291dba6e --- /dev/null +++ b/config/templates/config-example.conf @@ -0,0 +1,22 @@ +# Read build script documentation http://www.armbian.com/using-armbian-tools/ +# for detailed explanation of these options and for additional options not listed here + +KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt +KERNEL_CONFIGURE="no" # change provided kernel configuration +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, + # "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images", + # "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 + +# advanced +KERNEL_KEEP_CONFIG="no" # do not overwrite kernel config before compilation +EXTERNAL="yes" # build and install extra applications and drivers +EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages +CREATE_PATCHES="no" # wait that you make changes to uboot and kernel source and creates patches +BUILD_ALL="no" # cycle through available boards and make images or kernel/u-boot packages. + # set KERNEL_ONLY to "yes" or "no" to build all packages/all images + +BSPFREEZE="" # freeze armbian packages (u-boot, kernel, dtb) diff --git a/lib/main.sh b/lib/main.sh index 1cebe040c..4f8900795 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -12,6 +12,11 @@ # Main program # +if [[ $(basename $0) == main.sh ]]; then + echo "Please use compile.sh to start the build process" + exit -1 +fi + # destination DEST=$SRC/output diff --git a/lib/upgrade.sh b/lib/upgrade.sh new file mode 100644 index 000000000..61dcc3170 --- /dev/null +++ b/lib/upgrade.sh @@ -0,0 +1,32 @@ +# Copyright (c) 2015-2017 Igor Pecovnik, igor.pecovnik@gma**.com +# Copyright (c) 2015-2017 other Armbian contributors (https://github.com/armbian/build/graphs/contributors) +# +# This file is licensed under the terms of the GNU General Public +# License version 2. This program is licensed "as is" without any +# warranty of any kind, whether express or implied. +# +# This file is part of the Armbian build script https://github.com/armbian/build/ + +# Show info messages about changed directory structure +# when updating from older build script versions + +TTY_X=$(($(stty size | awk '{print $2}')-6)) # determine terminal width +TTY_Y=$(($(stty size | awk '{print $1}')-6)) # determine terminal height + +if [[ $(basename $0) == main.sh ]]; then + echo "Please use compile.sh to start the build process" + exit -1 +fi + +if [[ $(basename $0) == compile.sh ]]; then + # assuming dialog was installed already since this is supposed to be shown only on upgrade from previous versions + dialog --title "Directory structure change notice" --colors --msgbox "Build script directory structure was changed to simplify the build environment setup, \ + simplify upgrading in the future and improve compatibility with containers like Docker and Vagrant + + To upgrade please clone the repository \Z4https://github.com/armbian/build/\Zn into an empty directory and launch \Z2compile.sh\Zn + Copying and editing compile.sh is not required, build configuration is defined in \Z1config-*.conf\Zn files + Default build configuration is defined in \Z1config-default.conf\Zn (created on first build script run) + + Sorry for the inconvenience" $TTY_Y $TTY_X + exit -1 +fi diff --git a/main.sh b/main.sh new file mode 120000 index 000000000..8c504aa4f --- /dev/null +++ b/main.sh @@ -0,0 +1 @@ +lib/upgrade.sh \ No newline at end of file