diff --git a/lib/functions/compilation/packages/armbian-zsh-deb.sh b/lib/functions/compilation/packages/armbian-zsh-deb.sh index 55339b03c356..839613dcb7c3 100644 --- a/lib/functions/compilation/packages/armbian-zsh-deb.sh +++ b/lib/functions/compilation/packages/armbian-zsh-deb.sh @@ -78,6 +78,9 @@ compile_armbian-zsh() { # define default plugins sed -i 's/^plugins=.*/plugins=(evalcache git git-extras debian tmux screen history extract colorize web-search docker)/' "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc + # add collection of Armbian BASH aliases also to ZSH. They are compatible + cat "${SRC}"/packages/bsp/common/etc/skel/.bash_aliases >> "${tmp_dir}/${armbian_zsh_dir}"/etc/skel/.zshrc + chmod 755 "${tmp_dir}/${armbian_zsh_dir}"/DEBIAN/postinst dpkg_deb_build "${tmp_dir}/${armbian_zsh_dir}" "armbian-zsh" diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh index 782c5b155a44..ca6974c369c1 100644 --- a/lib/functions/rootfs/distro-agnostic.sh +++ b/lib/functions/rootfs/distro-agnostic.sh @@ -99,16 +99,14 @@ function install_distribution_agnostic() { echo -e "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^} \\l \n" > "${SDCARD}"/etc/issue echo "${VENDOR} ${IMAGE_VERSION:-"${REVISION}"} ${RELEASE^}" > "${SDCARD}"/etc/issue.net - # PRETTY_NAME changing in os-release is now done in armbian-base-files directly. + # Copy SKEL bashrc and profile to root user + cp "${SDCARD}"/etc/skel/.bashrc "${SDCARD}"/root/ + cp "${SDCARD}"/etc/skel/.profile "${SDCARD}"/root/ - # enable few bash aliases enabled in Ubuntu by default to make it even - sed "s/#alias ll='ls -l'/alias ll='ls -l'/" -i "${SDCARD}"/etc/skel/.bashrc - sed "s/#alias la='ls -A'/alias la='ls -A'/" -i "${SDCARD}"/etc/skel/.bashrc - sed "s/#alias l='ls -CF'/alias l='ls -CF'/" -i "${SDCARD}"/etc/skel/.bashrc - # root user is already there. Copy bashrc there as well - cp "${SDCARD}"/etc/skel/.bashrc "${SDCARD}"/root + # Copy systemwide alieases to root user too + cp "${SRC}"/packages/bsp/common/etc/skel/.bash_aliases "${SDCARD}"/root/ - # display welcome message at first root login @TODO: what reads this? + # display welcome message at first root login which is ready by /usr/sbin/armbian/armbian-firstlogin touch "${SDCARD}"/root/.not_logged_in_yet if [[ ${DESKTOP_AUTOLOGIN} == yes ]]; then diff --git a/packages/bsp/common/etc/skel/.bash_aliases b/packages/bsp/common/etc/skel/.bash_aliases new file mode 100644 index 000000000000..bf8e24991ed8 --- /dev/null +++ b/packages/bsp/common/etc/skel/.bash_aliases @@ -0,0 +1,6 @@ +# BASH or ZSH shell alieases +alias ll='ls -l' +alias la='ls -A' +alias l='ls -CF' +alias kernel="uname -r | sed 's/[1-9]\+[0-9]*\.[0-9]\+\.[0-9]\+-//' | sed 's/[1-9]\+[0-9]*\.[0-9]*\-rc[0-9]\+-//'" +alias showip='ip -4 addr show scope global | grep inet | awk "{print $2}" | cut -d"/" -f1 | sed "s/ inet //g" | paste -s -d, -' diff --git a/packages/bsp/common/etc/update-motd.d/41-commands b/packages/bsp/common/etc/update-motd.d/41-commands index b1c4f2f8aef9..70db18667504 100755 --- a/packages/bsp/common/etc/update-motd.d/41-commands +++ b/packages/bsp/common/etc/update-motd.d/41-commands @@ -14,6 +14,9 @@ MOTD_DISABLE="" [[ -f /etc/default/armbian-motd ]] && . /etc/default/armbian-motd +# read upgrade count to show upgrade command +[[ -f /var/cache/apt/archives/updates.number ]] && . /var/cache/apt/archives/updates.number + for f in $MOTD_DISABLE; do [[ $f == $THIS_SCRIPT ]] && exit 0 done @@ -22,6 +25,7 @@ done # condition can be fairly complex list=( "Configuration","","armbian-config","true" + "Upgrade","","armbian-upgrade","[[ \"${NUM_UPDATES}\" -gt 0 ]]" "Monitoring","","htop","true" ) diff --git a/packages/bsp/common/usr/sbin/armbian-install b/packages/bsp/common/usr/bin/armbian-install similarity index 99% rename from packages/bsp/common/usr/sbin/armbian-install rename to packages/bsp/common/usr/bin/armbian-install index a4280c0c0e56..6f264d343149 100755 --- a/packages/bsp/common/usr/sbin/armbian-install +++ b/packages/bsp/common/usr/bin/armbian-install @@ -20,6 +20,9 @@ # $4 = :space: separated list of all MTD device names # Note: MTD char device names are passed in format device_name:partition_label - e.g.: mtd0:SPL +trap "exit" INT TERM +[[ $EUID != 0 ]] && exec sudo "$0" "$@" + [[ -f /usr/lib/u-boot/platform_install.sh ]] && source /usr/lib/u-boot/platform_install.sh # ORIGINAL_SCRIPT_NAME: Must be either armbian-install or nand-sata-install diff --git a/packages/bsp/common/usr/bin/armbian-upgrade b/packages/bsp/common/usr/bin/armbian-upgrade new file mode 100755 index 000000000000..ec0c0f1a4530 --- /dev/null +++ b/packages/bsp/common/usr/bin/armbian-upgrade @@ -0,0 +1,8 @@ +#!/bin/bash +trap "exit" INT TERM +[[ $EUID != 0 ]] && exec sudo "$0" "$@" +apt update +apt -y upgrade +apt clean +apt -y autoremove +exit 0 diff --git a/packages/bsp/common/usr/sbin/nand-sata-install b/packages/bsp/common/usr/bin/nand-sata-install similarity index 100% rename from packages/bsp/common/usr/sbin/nand-sata-install rename to packages/bsp/common/usr/bin/nand-sata-install diff --git a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates index 87f4e00f7aa2..ce32e48edcd4 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-apt-updates +++ b/packages/bsp/common/usr/lib/armbian/armbian-apt-updates @@ -36,6 +36,9 @@ fi myfile="/var/cache/apt/archives/updates.number" myfiles="/var/cache/apt/archives/updates.list" +# create folder as it doesn't exists at start to prevent erroring +mkdir -p "/var/cache/apt/archives/" + # update procedure DISTRO=$(lsb_release -c | cut -d ":" -f 2 | tr -d '[:space:]') && DISTRO=${DISTRO,,}