diff --git a/config/kernel/linux-meson64-next.config b/config/kernel/linux-meson64-next.config index 12b74110ac..25a69dc5e9 100644 --- a/config/kernel/linux-meson64-next.config +++ b/config/kernel/linux-meson64-next.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.19.53 Kernel Configuration +# Linux/arm64 4.19.64 Kernel Configuration # # @@ -2007,7 +2007,7 @@ CONFIG_LED_TRIGGER_PHY=y # CONFIG_SFP is not set # CONFIG_AMD_PHY is not set # CONFIG_AQUANTIA_PHY is not set -# CONFIG_ASIX_PHY is not set +CONFIG_AX88796B_PHY=m # CONFIG_AT803X_PHY is not set # CONFIG_BCM7XXX_PHY is not set # CONFIG_BCM87XX_PHY is not set @@ -2241,7 +2241,6 @@ CONFIG_WLCORE_SPI=m CONFIG_WLCORE_SDIO=m CONFIG_WILINK_PLATFORM_DATA=y CONFIG_RTL8822BU=m -CONFIG_RTL8821AU=m CONFIG_RTL8812AU=m CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m diff --git a/config/kernel/linux-odroidc1-next.config b/config/kernel/linux-odroidc1-next.config index 95d26fc282..dd824df32a 100644 --- a/config/kernel/linux-odroidc1-next.config +++ b/config/kernel/linux-odroidc1-next.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.2.1 Kernel Configuration +# Linux/arm 5.2.7 Kernel Configuration # # @@ -884,6 +884,8 @@ CONFIG_XFRM_INTERFACE=m CONFIG_XFRM_IPCOMP=m # CONFIG_NET_KEY is not set CONFIG_INET=y +CONFIG_WIREGUARD=m +# CONFIG_WIREGUARD_DEBUG is not set # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_ROUTE_CLASSID=y @@ -3413,7 +3415,7 @@ CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y # CONFIG_THERMAL_WRITABLE_TRIPS is not set -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set # CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y @@ -3421,7 +3423,7 @@ CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_BANG_BANG is not set # CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set +CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y # CONFIG_CLOCK_THERMAL is not set # CONFIG_DEVFREQ_THERMAL is not set @@ -6216,6 +6218,23 @@ CONFIG_PSTORE_PMSG=y CONFIG_PSTORE_RAM=y # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set +CONFIG_AUFS_FS=m +CONFIG_AUFS_BRANCH_MAX_127=y +# CONFIG_AUFS_BRANCH_MAX_511 is not set +# CONFIG_AUFS_BRANCH_MAX_1023 is not set +# CONFIG_AUFS_BRANCH_MAX_32767 is not set +CONFIG_AUFS_SBILIST=y +# CONFIG_AUFS_HNOTIFY is not set +# CONFIG_AUFS_EXPORT is not set +# CONFIG_AUFS_XATTR is not set +# CONFIG_AUFS_FHSM is not set +# CONFIG_AUFS_RDU is not set +# CONFIG_AUFS_DIRREN is not set +# CONFIG_AUFS_SHWH is not set +# CONFIG_AUFS_BR_RAMFS is not set +# CONFIG_AUFS_BR_FUSE is not set +CONFIG_AUFS_BDEV_LOOP=y +# CONFIG_AUFS_DEBUG is not set CONFIG_NETWORK_FILESYSTEMS=y CONFIG_NFS_FS=y CONFIG_NFS_V2=y @@ -6731,6 +6750,7 @@ CONFIG_CC_HAS_SANCOV_TRACE_PC=y CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 CONFIG_SCHED_DEBUG=y +CONFIG_SCHED_INFO=y # CONFIG_SCHEDSTATS is not set # CONFIG_SCHED_STACK_END_CHECK is not set # CONFIG_DEBUG_TIMEKEEPING is not set diff --git a/config/kernel/linux-odroidxu4-dev.config b/config/kernel/linux-odroidxu4-dev.config index 804156a48b..beb91c3e08 100644 --- a/config/kernel/linux-odroidxu4-dev.config +++ b/config/kernel/linux-odroidxu4-dev.config @@ -830,6 +830,8 @@ CONFIG_XFRM_IPCOMP=m CONFIG_NET_KEY=y CONFIG_NET_KEY_MIGRATE=y CONFIG_INET=y +CONFIG_WIREGUARD=m +# CONFIG_WIREGUARD_DEBUG is not set CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_FIB_TRIE_STATS=y diff --git a/config/sources/meson64.conf b/config/sources/meson64.conf index a2e8f2b6ba..8713ea8363 100644 --- a/config/sources/meson64.conf +++ b/config/sources/meson64.conf @@ -195,8 +195,8 @@ family_tweaks() family_tweaks_bsp() { - mkdir -p $destination/etc/udev/rules.d - mkdir -p $destination/usr/local/bin - cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d - install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin + mkdir -p $destination/etc/udev/rules.d + mkdir -p $destination/usr/local/bin + cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d + install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin } diff --git a/lib/build-all.sh b/lib/build-all.sh index 0ccf0315f1..294b602424 100644 --- a/lib/build-all.sh +++ b/lib/build-all.sh @@ -234,7 +234,7 @@ for line in "${buildlist[@]}"; do ATF_COMPILER ATF_USE_GCC ATFSOURCE ATFDIR ATFBRANCH ATFSOURCEDIR PACKAGE_LIST_RM NM_IGNORE_DEVICES DISPLAY_MANAGER family_tweaks_bsp_s \ CRYPTROOT_ENABLE CRYPTROOT_PASSPHRASE CRYPTROOT_SSH_UNLOCK CRYPTROOT_SSH_UNLOCK_PORT CRYPTROOT_SSH_UNLOCK_KEY_NAME ROOT_MAPPER \ NETWORK HDMI USB WIRELESS ARMBIANMONITOR DEFAULT_CONSOLE FORCE_BOOTSCRIPT_UPDATE SERIALCON UBOOT_TOOLCHAIN2 toolchain2 \ - BUILD_REPOSITORY_URL BUILD_REPOSITORY_COMMIT DESKTOP_AUTOLOGIN + BUILD_REPOSITORY_URL BUILD_REPOSITORY_COMMIT DESKTOP_AUTOLOGIN BUILD_MINIMAL read -r BOARD BRANCH RELEASE BUILD_DESKTOP <<< "${line}" ((n+=1)) diff --git a/lib/configuration.sh b/lib/configuration.sh index 21053f34b4..cf1c703196 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -126,26 +126,38 @@ BOOTCONFIG_VAR_NAME=BOOTCONFIG_${BRANCH^^} [[ -z $BOOTPATCHDIR ]] && BOOTPATCHDIR="u-boot-$LINUXFAMILY" [[ -z $KERNELPATCHDIR ]] && KERNELPATCHDIR="$LINUXFAMILY-$BRANCH" -if [[ $RELEASE == xenial || $RELEASE == bionic || $RELEASE == disco ]]; then DISTRIBUTION="Ubuntu"; else DISTRIBUTION="Debian"; fi +if [[ $RELEASE == xenial || $RELEASE == bionic || $RELEASE == disco ]]; then + DISTRIBUTION="Ubuntu" + else + DISTRIBUTION="Debian" +fi + +# Base system dependencies. Since adding MINIMAL_IMAGE we rely on "variant=minbase" which has very basic package set +DEBOOTSTRAP_LIST="locales gnupg ifupdown apt-utils apt-transport-https ca-certificates bzip2 console-setup cpio cron \ + dbus init initramfs-tools iputils-ping isc-dhcp-client kmod less libpam-systemd \ + linux-base logrotate netbase netcat-openbsd rsyslog systemd sudo ucf udev whiptail \ + wireless-regdb crda dmsetup rsync" + +[[ $BUILD_DESKTOP == yes ]] && DEBOOTSTRAP_LIST+=" libgtk2.0-bin" + +# tab cleanup is mandatory +DEBOOTSTRAP_LIST=$(echo $DEBOOTSTRAP_LIST | sed -e 's,\\[trn],,g') -# Base system dependencies -DEBOOTSTRAP_LIST="locales,gnupg,ifupdown,apt-transport-https,ca-certificates" -[[ $BUILD_DESKTOP == yes ]] && DEBOOTSTRAP_LIST+=",libgtk2.0-bin" # Essential packages PACKAGE_LIST="bc bridge-utils build-essential cpufrequtils device-tree-compiler figlet fbset fping \ - iw fake-hwclock wpasupplicant psmisc ntp parted rsync sudo curl linux-base dialog crda \ + iw fake-hwclock wpasupplicant psmisc ntp parted sudo curl linux-base dialog crda \ wireless-regdb ncurses-term python3-apt sysfsutils toilet u-boot-tools unattended-upgrades \ usbutils wireless-tools console-setup unicode-data openssh-server initramfs-tools \ ca-certificates resolvconf expect iptables automake nocache debconf-utils html2text \ - bison flex libwrap0-dev libssl-dev libnl-3-dev libnl-genl-3-dev" + bison flex libwrap0-dev libssl-dev libnl-3-dev libnl-genl-3-dev wget keyboard-configuration" # Non-essential packages PACKAGE_LIST_ADDITIONAL="armbian-firmware alsa-utils btrfs-tools dosfstools iotop iozone3 stress screen \ ntfs-3g vim pciutils evtest htop pv lsof libfuse2 libdigest-sha-perl \ libproc-processtable-perl aptitude dnsutils f3 haveged hdparm rfkill vlan sysstat bash-completion \ - hostapd git ethtool network-manager unzip ifenslave command-not-found libpam-systemd iperf3 \ + hostapd git ethtool network-manager unzip ifenslave command-not-found libpam-systemd iperf3 nano \ software-properties-common libnss-myhostname f2fs-tools avahi-autoipd iputils-arping qrencode mmc-utils sunxi-tools" @@ -158,54 +170,71 @@ PACKAGE_LIST_DESKTOP="xserver-xorg xserver-xorg-video-fbdev gvfs-backends gvfs-f # Recommended desktop packages -PACKAGE_LIST_DESKTOP_RECOMMENDS="mirage galculator hexchat xfce4-screenshooter network-manager-openvpn-gnome mpv fbi cups-pk-helper \ - cups geany atril xarchiver" +PACKAGE_LIST_DESKTOP_RECOMMENDS="mirage galculator hexchat xfce4-screenshooter network-manager-openvpn-gnome mpv fbi \ + cups-pk-helper cups geany atril xarchiver" + + +# For minimal build different set of packages is needed +if [[ $BUILD_MINIMAL == yes ]]; then + + # Essential packages for minimal build + PACKAGE_LIST="bc cpufrequtils device-tree-compiler fping fake-hwclock psmisc ntp parted dialog \ + ncurses-term sysfsutils toilet figlet u-boot-tools usbutils openssh-server \ + nocache debconf-utils" + + # Non-essential packages for minimal build + PACKAGE_LIST_ADDITIONAL="network-manager wireless-tools lsof htop mmc-utils wget armbian-firmware nano sysstat net-tools" + +fi # Release specific packages case $RELEASE in jessie) DEBOOTSTRAP_COMPONENTS="main" - PACKAGE_LIST_RELEASE="less kbd gnupg2 dirmngr sysbench" - PACKAGE_LIST_DESKTOP+=" paman libgcr-3-common gcj-jre-headless policykit-1-gnome eject numix-icon-theme libgnome2-perl pulseaudio-module-gconf" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE=" kbd gnupg2 dirmngr sysbench" + PACKAGE_LIST_DESKTOP+=" paman libgcr-3-common gcj-jre-headless policykit-1-gnome eject numix-icon-theme \ + libgnome2-perl pulseaudio-module-gconf" PACKAGE_LIST_DESKTOP_RECOMMENDS+=" iceweasel pluma system-config-printer leafpad" ;; xenial) DEBOOTSTRAP_COMPONENTS="main" - PACKAGE_LIST_RELEASE="man-db wget nano sysbench" - PACKAGE_LIST_DESKTOP+=" paman libgcr-3-common gcj-jre-headless paprefs numix-icon-theme libgnome2-perl pulseaudio-module-gconf" - PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser language-selector-gnome system-config-printer-common system-config-printer-gnome leafpad" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE="man-db sysbench" + PACKAGE_LIST_DESKTOP+=" paman libgcr-3-common gcj-jre-headless paprefs numix-icon-theme libgnome2-perl \ + pulseaudio-module-gconf" + PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser language-selector-gnome system-config-printer-common \ + system-config-printer-gnome leafpad" ;; stretch) DEBOOTSTRAP_COMPONENTS="main" - PACKAGE_LIST_RELEASE="man-db less kbd net-tools netcat-openbsd gnupg2 dirmngr sysbench" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE="man-db kbd net-tools gnupg2 dirmngr sysbench" PACKAGE_LIST_DESKTOP+=" paman libgcr-3-common gcj-jre-headless paprefs dbus-x11 libgnome2-perl pulseaudio-module-gconf" PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium system-config-printer-common system-config-printer leafpad" ;; bionic) DEBOOTSTRAP_COMPONENTS="main,universe" - PACKAGE_LIST_RELEASE="man-db less kbd net-tools netcat-openbsd gnupg2 dirmngr nano wget" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE="man-db kbd net-tools gnupg2 dirmngr" PACKAGE_LIST_DESKTOP+=" xserver-xorg-input-all paprefs dbus-x11 libgnome2-perl pulseaudio-module-gconf" - PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser system-config-printer-common system-config-printer language-selector-gnome leafpad" + PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser system-config-printer-common system-config-printer \ + language-selector-gnome leafpad" ;; buster) DEBOOTSTRAP_COMPONENTS="main" - PACKAGE_LIST_RELEASE="man-db less kbd net-tools netcat-openbsd gnupg2 dirmngr wget" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE="man-db kbd net-tools gnupg2 dirmngr" PACKAGE_LIST_DESKTOP+=" paprefs dbus-x11 numix-icon-theme" PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium system-config-printer-common system-config-printer" ;; disco) DEBOOTSTRAP_COMPONENTS="main,universe" - PACKAGE_LIST_RELEASE="man-db less kbd net-tools netcat-openbsd gnupg2 dirmngr nano wget" + [[ -z $BUILD_MINIMAL || $BUILD_MINIMAL == no ]] && PACKAGE_LIST_RELEASE="man-db kbd net-tools gnupg2 dirmngr" PACKAGE_LIST_DESKTOP+=" xserver-xorg-input-all paprefs dbus-x11 pulseaudio-module-gsettings" - PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser system-config-printer-common system-config-printer language-selector-gnome" - # temp disable - PACKAGE_LIST_ADDITIONAL="${PACKAGE_LIST_ADDITIONAL/armbian-firmware /}" + PACKAGE_LIST_DESKTOP_RECOMMENDS+=" chromium-browser system-config-printer-common system-config-printer \ + language-selector-gnome" ;; esac @@ -278,6 +307,7 @@ $(getfacl -p "${SRC}"/.tmp) Build target: Board: $BOARD Branch: $BRANCH +Minimal: $BUILD_MINIMAL Desktop: $BUILD_DESKTOP Kernel configuration: diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh index 89c46927d2..d00f2a35f1 100644 --- a/lib/debootstrap.sh +++ b/lib/debootstrap.sh @@ -66,7 +66,7 @@ debootstrap_ng() customize_image # create list of installed packages for debug purposes - chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > $DEST/debug/installed-packages-${RELEASE}-${BUILD_DESKTOP}.list 2>&1 + chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > $DEST/debug/installed-packages-${RELEASE}$([[ ${BUILD_MINIMAL} == yes ]] && echo "-minimal")$([[ ${BUILD_DESKTOP} == yes ]] && echo "-desktop").list 2>&1 # clean up / prepare for making the image umount_chroot "$SDCARD" @@ -132,8 +132,9 @@ create_rootfs_cache() # fancy progress bars [[ -z $OUTPUT_DIALOG ]] && local apt_extra_progress="--show-progress -o DPKG::Progress-Fancy=1" + display_alert "Installing base system" "Stage 1/2" "info" - eval 'debootstrap --include=${DEBOOTSTRAP_LIST} ${PACKAGE_LIST_EXCLUDE:+ --exclude=${PACKAGE_LIST_EXCLUDE// /,}} \ + eval 'debootstrap --variant=minbase --include=${DEBOOTSTRAP_LIST// /,} ${PACKAGE_LIST_EXCLUDE:+ --exclude=${PACKAGE_LIST_EXCLUDE// /,}} \ --arch=$ARCH --components=${DEBOOTSTRAP_COMPONENTS} --foreign $RELEASE $SDCARD/ $apt_mirror' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Debootstrap (stage 1/2)..." $TTY_Y $TTY_X'} \ @@ -144,7 +145,7 @@ create_rootfs_cache() cp /usr/bin/$QEMU_BINARY $SDCARD/usr/bin/ mkdir -p $SDCARD/usr/share/keyrings/ - cp /usr/share/keyrings/debian-archive-keyring.gpg $SDCARD/usr/share/keyrings/ + cp /usr/share/keyrings/*-archive-keyring.gpg $SDCARD/usr/share/keyrings/ display_alert "Installing base system" "Stage 2/2" "info" eval 'chroot $SDCARD /bin/bash -c "/debootstrap/debootstrap --second-stage"' \ @@ -230,13 +231,13 @@ create_rootfs_cache() [[ ${PIPESTATUS[0]} -ne 0 ]] && exit_with_error "Installation of Armbian packages failed" + # stage: remove downloaded packages + chroot $SDCARD /bin/bash -c "apt-get clean" + # DEBUG: print free space echo -e "\nFree space:" eval 'df -h' ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} - # stage: remove downloaded packages - chroot $SDCARD /bin/bash -c "apt-get clean" - # create list of installed packages for debug purposes chroot $SDCARD /bin/bash -c "dpkg --get-selections" | grep -v deinstall | awk '{print $1}' | cut -f1 -d':' > ${cache_fname}.list 2>&1 @@ -547,6 +548,7 @@ create_image() # stage: create file name local version="Armbian_${REVISION}_${BOARD^}_${DISTRIBUTION}_${RELEASE}_${BRANCH}_${VER/-$LINUXFAMILY/}" [[ $BUILD_DESKTOP == yes ]] && version=${version}_desktop + [[ $BUILD_MINIMAL == yes ]] && version=${version}_minimal [[ $ROOTFS_TYPE == nfs ]] && version=${version}_nfsboot if [[ $ROOTFS_TYPE != nfs ]]; then diff --git a/lib/distributions.sh b/lib/distributions.sh index a6a04c9d7b..9ef75762d2 100644 --- a/lib/distributions.sh +++ b/lib/distributions.sh @@ -297,6 +297,9 @@ install_common() # configure network manager sed "s/managed=\(.*\)/managed=true/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf + # remove network manager defaults to handle eth by default + rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf + # Just regular DNS and maintain /etc/resolv.conf as a file sed "/dns/d" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf sed "s/\[main\]/\[main\]\ndns=default\nrc-manager=file/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf @@ -308,7 +311,7 @@ install_common() EOF fi - # nsswitch settings for sane DNS behavior: remove resolve, assure libnss-myhostname support + # nsswitch settings for sane DNS behavior: remove resolve, assure libnss-myhostname support sed "s/hosts\:.*/hosts: files mymachines dns myhostname/g" -i "${SDCARD}"/etc/nsswitch.conf } @@ -381,7 +384,7 @@ install_distribution_specific() EOF chmod +x "${SDCARD}"/etc/rc.local # Basic Netplan config. Let NetworkManager manage all devices on this system - cat <<-EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml + [[ -d "${SDCARD}"/etc/netplan ]] && cat <<-EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml network: version: 2 renderer: NetworkManager @@ -440,7 +443,7 @@ install_distribution_specific() EOF chmod +x "${SDCARD}"/etc/rc.local # Basic Netplan config. Let NetworkManager manage all devices on this system - cat <<-EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml + [[ -d "${SDCARD}"/etc/netplan ]] && cat <<-EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml network: version: 2 renderer: NetworkManager diff --git a/lib/main.sh b/lib/main.sh index aa89903eb5..0fb4d16752 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -270,9 +270,26 @@ if [[ $KERNEL_ONLY != yes && -z $BUILD_DESKTOP ]]; then --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}") unset options [[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected" + [[ $BUILD_DESKTOP == yes ]] && BUILD_MINIMAL=no fi +if [[ $KERNEL_ONLY != yes && $BUILD_DESKTOP == no && -z $BUILD_MINIMAL ]]; then + + options=() + options+=("no" "Standard image with console interface") + options+=("yes" "Minimal image with console interface") + BUILD_MINIMAL=$(dialog --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags \ + --menu "Select the target image type" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}") + unset options + [[ -z $BUILD_MINIMAL ]] && exit_with_error "No option selected" + +fi + +#prevent conflicting setup +[[ $BUILD_DESKTOP == yes ]] && BUILD_MINIMAL=no +[[ $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no && EXTERNAL=no + #shellcheck source=configuration.sh source "${SRC}"/lib/configuration.sh @@ -390,6 +407,7 @@ display_alert "Runtime" "$runtime min" "info" [ `systemd-detect-virt` == 'docker' ] && BUILD_CONFIG='docker' display_alert "Repeat Build Options" "./compile.sh ${BUILD_CONFIG} BOARD=${BOARD} BRANCH=${BRANCH} \ $([[ -n $RELEASE ]] && echo "RELEASE=${RELEASE} ")\ +$([[ -n $BUILD_MINIMAL ]] && echo "BUILD_MINIMAL=${BUILD_MINIMAL} ")\ $([[ -n $BUILD_DESKTOP ]] && echo "BUILD_DESKTOP=${BUILD_DESKTOP} ")\ $([[ -n $KERNEL_ONLY ]] && echo "KERNEL_ONLY=${KERNEL_ONLY} ")\ $([[ -n $KERNEL_CONFIGURE ]] && echo "KERNEL_CONFIGURE=${KERNEL_CONFIGURE} ")\ diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 849ac2f95e..a4f0f1815d 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -50,11 +50,11 @@ create_board_package() Installed-Size: 1 Section: kernel Priority: optional - Depends: bash, linux-base, u-boot-tools, initramfs-tools, python3-apt + Depends: bash, linux-base, u-boot-tools, initramfs-tools Provides: armbian-bsp Conflicts: armbian-bsp Suggests: armbian-config - Replaces: zram-config, base-files, armbian-tools-$RELEASE + Replaces: lsb-release, zram-config, base-files, armbian-tools-$RELEASE Recommends: bsdutils, parted, util-linux, toilet Description: Armbian tweaks for $RELEASE on $BOARD ($BRANCH branch) EOF diff --git a/packages/bsp/common/usr/bin/lsb_release b/packages/bsp/common/usr/bin/lsb_release new file mode 100755 index 0000000000..80a9a025a9 --- /dev/null +++ b/packages/bsp/common/usr/bin/lsb_release @@ -0,0 +1,143 @@ +#!/bin/sh +# +# Simple alternative to /usr/bin/lsb_release which doesn't require python. +# +# Based on https://gist.github.com/skx/1f9e5240856c5976193a +# +# If /etc/os-release exists then we use that to output data +# in a compatible format to the original lsb_release utility. + +show_help() { + cat << EOF +Usage: lsb_release [options] + +Options: + -h, --help show this help message and exit + -i, --id show distributor ID + -d, --description show description of this distribution + -r, --release show release number of this distribution + -c, --codename show code name of this distribution + -a, --all show all of the above information + -s, --short show requested information in short format +EOF + exit 0 +} + + +# +# Potential command-line options. +# +all=0 +codename=0 +description=0 +id=0 +release=0 +short=0 +version=0 + + +# +# Process each argument, and set the appropriate flag +# if we recognize it. +# +while :; do + case $1 in + -a|--all) + all=1 + ;; + -c|--codename) + codename=1 + ;; + -d|--description) + description=1 + ;; + -h|--help) + show_help + break + ;; + -i|--id) + id=1 + ;; + -r|--release) + release=1 + ;; + -s|--short) + short=1 + ;; + -v|--version) + version=1 + ;; + -cs|-sc) + short=1 + codename=1 + ;; + -is|-si) + short=1 + id=1 + ;; + -ds|-sd) + short=1 + description=1 + ;; + -as|-sa) + short=1 + all=1 + ;; + *) + break + esac + shift +done + + +# +# Read our variables. +# +if [ -e /etc/os-release ]; then + . /etc/os-release +else + echo "/etc/os-release is not present. Aborting" >&2 + exit 1 +fi + + +# +# Now output the data - The order of these was chosen to match +# what the original lsb_release used, and while I suspect it doesn't +# matter I kept it the same. +# +if [ "$all" = "1" ] || [ "$id" = "1" ]; then + if [ "$short" = "0" ]; then + printf "Distributor ID:\t" + fi + echo $ID | sed 's/./\U&/' +fi + +if [ "$all" = "1" ] || [ "$description" = "1" ]; then + if [ "$short" = "0" ]; then + printf "Description:\t" + fi + echo $PRETTY_NAME +fi + +if [ "$all" = "1" ] || [ "$release" = "1" ]; then + if [ "$short" = "0" ]; then + printf "Release:\t" + fi + echo $VERSION_ID +fi + +if [ "$all" = "1" ] || [ "$codename" = "1" ]; then + if [ "$short" = "0" ]; then + printf "Codename:\t" + fi + + # + # Codename comes from: VERSION="7 (wheezy)" + # + ver=$(echo $VERSION | awk '{print $2}' | tr -d \(\)) + if [ $ID = "ubuntu" ]; then echo "$UBUNTU_CODENAME"; else echo "$ver"; fi +fi + + +exit 0 diff --git a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates index 84a27350a8..09a77b726c 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates +++ b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates @@ -1,10 +1,9 @@ -#!/usr/bin/python3 +#!/bin/bash # # 40-updates - create the list of packages for update with caching -# Copyright (c) 2015 Igor Pecovnik +# Copyright (c) 2015 Arkadiusz Raj # -# Author: Igor Pecovnik igor.pecovnik@gmail.com -# Based upon prior work by Nick Charlton, Dustin Kirkland and Michael Vogt. +# Author: Arkadiusz Raj arek.raj@gmail.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,115 +19,37 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import sys -import subprocess -import apt_pkg -import time -import os -import os.path as path -import fcntl -lock_file = '/var/run/armbian-motd-updates.lock' -fp = open(lock_file, 'w') -try: - fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) -except IOError: - # another instance is running - sys.exit(0) - -myfile = "/var/cache/apt/archives/updates.number" - -# update procedure -DISTRO = subprocess.Popen(["lsb_release", "-c", "-s"], stdout=subprocess.PIPE).communicate()[0].strip() - -class OpNullProgress(object): - '''apt progress handler which supresses any output.''' - def update(self): - pass - def done(self): - pass - -def is_security_upgrade(pkg): - ''' - Checks to see if a package comes from a DISTRO-security source. - ''' - security_package_sources = [("Ubuntu", "%s-security" % DISTRO), - ("Debian", "%s-security" % DISTRO)] - - for (file, index) in pkg.file_list: - for origin, archive in security_package_sources: - if (file.archive == archive and file.origin == origin): - return True - return False - -# init apt and config -apt_pkg.init() - -# open the apt cache -try: - cache = apt_pkg.Cache(OpNullProgress()) -except SystemError as e: - sys.stderr.write("Error: Opening the cache (%s)" % e) - sys.exit(0) - -# setup a DepCache instance to interact with the repo -depcache = apt_pkg.DepCache(cache) - -# take into account apt policies -depcache.read_pinfile() - -# initialise it -depcache.init() +lock_file='/var/run/armbian-motd-updates.lock' +if { set -C; 2>/dev/null >${lock_file}; }; then + trap "rm -f ${lock_file}" EXIT +else + exit 0 +fi # give up if packages are broken -if depcache.broken_count > 0: - sys.stderr.write("Error: Broken packages exist.") - sys.exit(0) +[[ ! $(dpkg -l | grep ^..r) ]] && exit 0 -# mark possible packages -try: - # run distro-upgrade - depcache.upgrade(True) - # reset if packages get marked as deleted -> we don't want to break anything - if depcache.del_count > 0: - depcache.init() +myfile="/var/cache/apt/archives/updates.number" - # then a standard upgrade - depcache.upgrade() -except SystemError as e: - sys.stderr.write("Error: Couldn't mark the upgrade (%s)" % e) - sys.exit(0) +# update procedure +DISTRO=$(lsb_release -c | cut -d ":" -f 2 | tr -d '[:space:]') && DISTRO=${DISTRO,,} # run around the packages -upgrades = 0 -security_upgrades = 0 -for pkg in cache.packages: - candidate = depcache.get_candidate_ver(pkg) - current = pkg.current_ver +upgrades=0 +security_upgrades=0 +while IFS= read -r LINE; do + # increment the upgrade counter + (( upgrades++ )) + # keep another count for security upgrades + [[ ${LINE} == *"${DISTRO}-sec"* ]] && (( security_upgrades++ )) +done < <(apt-get upgrade -s -qq | sed -n '/^Inst/p') - # skip packages not marked as upgraded/installed - if not (depcache.marked_install(pkg) or depcache.marked_upgrade(pkg)): - continue +cat >|${myfile} <