Skip to content

Commit

Permalink
UX: cosmetic improvements on motd and armbian-install
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Sep 18, 2024
1 parent 5396ffb commit 17e1af6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/bsp/common/etc/update-motd.d/41-commands
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ for f in $MOTD_DISABLE; do
[[ $f == $THIS_SCRIPT ]] && exit 0
done

# text, sudo / without, command, condition
# condition can be fairly complex
list=(
"System config","sudo ","armbian-config"
"System monitor","","htop"
"System config","sudo ","armbian-config","true"
"System monitor","","htop","true"
"Installer","","armbian-install","! grep -q \"INSTALLED=true\" /etc/armbian-image-release 2> /dev/null && ((($(date +%s) - $(stat -c +%X /etc/armbian-image-release 2> /dev/null)) < 86400))"
)

# verify if command exits on the system
Expand All @@ -32,7 +35,8 @@ do
name=$(echo $l | cut -d"," -f1)
sudo=$(echo $l | cut -d"," -f2)
command=$(echo $l | cut -d"," -f3)
if command -v $command &> /dev/null
condition=$(echo $l | cut -d"," -f4)
if eval $condition 2> /dev/null && command -v $command &> /dev/null
then
# seek for maximum description lenght
if [ ${#name} -ge $name_len ]; then
Expand Down
5 changes: 3 additions & 2 deletions packages/bsp/common/usr/lib/armbian/armbian-firstlogin
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ set_shell() {
;;
esac
done
# Display shell selection only if needs to be selected
echo -e "\nShell: \x1B[92m${USER_SHELL^^}\x1B[0m"
fi
SHELL_PATH=$(grep "/$USER_SHELL$" /etc/shells | tail -1)

SHELL_PATH=$(grep "/$USER_SHELL$" /etc/shells | tail -1)
chsh -s "$(grep -iF "/$USER_SHELL" /etc/shells | tail -1)"
echo -e "\nShell: \x1B[92m${USER_SHELL^^}\x1B[0m"

# change shell for future users
sed -i "s|^SHELL=.*|SHELL=${SHELL_PATH}|" /etc/default/useradd
Expand Down
5 changes: 5 additions & 0 deletions packages/bsp/common/usr/sbin/armbian-install
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ create_armbian()
dialog --title "$title" --backtitle "$backtitle" --infobox "\n Cleaning up ... Almost done." 5 60
rsync -avx --delete --exclude-from=$EX_LIST / "${TempDir}"/rootfs >/dev/null 2>&1

# mark OS as transferred
if ! grep -q "INSTALLED=true" /etc/armbian-image-release; then
echo "INSTALLED=true" >> "${TempDir}"/rootfs/etc/armbian-image-release
fi

# creating fstab from scratch
rm -f "${TempDir}"/rootfs/etc/fstab
mkdir -p "${TempDir}"/rootfs/etc "${TempDir}"/rootfs/media/mmcboot "${TempDir}"/rootfs/media/mmcroot
Expand Down

0 comments on commit 17e1af6

Please sign in to comment.