Skip to content

Commit

Permalink
Firstlogin: run provision script if it does exists
Browse files Browse the repository at this point in the history
- fixing motd setting executing bit at wrong place
- when setting fixed address with 1st run, remove DHCP on all lan networks
  • Loading branch information
igorpecovnik committed Jan 12, 2025
1 parent a09e8b8 commit bb02c3b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/bsp/common/usr/lib/armbian/armbian-firstlogin
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ do_firstrun_automated_network_configuration()
# - Ethernet enable
elif [[ $PRESET_NET_ETHERNET_ENABLED == 1 ]]; then

# remove dhcp config
rm -f /etc/netplan/10-dhcp-all-interfaces.yaml

DEVICE_NAME=${eth_index}
DEVTYPE=ethernets
echo -e "$(createYAML)" > /etc/netplan/30-${DEVTYPE}${CONFIG_NAME}.yaml
Expand Down Expand Up @@ -607,7 +610,6 @@ add_user() {
echo -e "\nDear \e[0;92m${RealName}\x1B[0m, your account \e[0;92m${RealUserName}\x1B[0m has been created and is sudo enabled."
echo -e "Please use this account for your daily work from now on.\n"
rm -f /root/.not_logged_in_yet
chmod +x /etc/update-motd.d/*
# set up profile sync daemon on desktop systems
if command -v psd > /dev/null 2>&1; then
echo -e "${RealUserName} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers
Expand Down Expand Up @@ -706,6 +708,9 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
loginfrom=$(who am i | awk '{print $2}')
who -la | grep root | grep -v "$loginfrom" | awk '{print $7}' | xargs --no-run-if-empty kill -9

# enable motd
chmod +x /etc/update-motd.d/*

first_input="$password"
if [ -z "$PRESET_ROOT_PASSWORD" ];then
echo ""
Expand Down Expand Up @@ -932,5 +937,11 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
printf "\n\n\e[0;91mWarning: a reboot is needed to finish resizing the filesystem \x1B[0m \n"
printf "\e[0;91mPlease reboot the system now \x1B[0m \n\n"
fi

fi
fi

# Run provisioning script if exists
if [[ -f /root/provisioning.sh ]]; then
. /root/provisioning.sh
fi

0 comments on commit bb02c3b

Please sign in to comment.