Skip to content

Commit

Permalink
v6.26
Browse files Browse the repository at this point in the history
+ DietPi-Software | Firstrun: Do a full APT upgrade (including firmware/dependency changes) on first run installs, since it is safe to do it here and to assure that all systems are lifted to the same package/firmware stage: #3098
+ DietPi-Software | Firstrun: No time sync mode requires additional packages anymore, thus set it along with other AUTOINSTALL settings
+ DietPi-Software | Firstrun: Set defaults for automation settings missing in dietpi.txt
  • Loading branch information
MichaIng authored Sep 15, 2019
1 parent bc3c8a8 commit b81bee4
Showing 1 changed file with 41 additions and 46 deletions.
87 changes: 41 additions & 46 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -14436,25 +14436,16 @@ _EOF_
#------------------------------------------------------------
# Update & upgrade APT
Banner_Apt_Update

# - Update APT list
# - Update APT lists
G_AGUP

# - Simulated APT installation to check for failures related to apt-cache.
G_DIETPI-NOTIFY 2 'Running apt simulation to check for errors, please wait...'
local package_to_test='bash-doc'
G_AGI $package_to_test -s

# - Upgrade APT packages
G_AGUG

# - Automation Set NTPD mode
# Due to possible packages required, must be done here after APT cache updated
if (( $G_DIETPI_INSTALL_STAGE == 1 )); then

/DietPi/dietpi/func/dietpi-set_software ntpd-mode $(grep -m1 '^[[:blank:]]*CONFIG_NTP_MODE=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')

fi
# - Full upgrade on first run installs: https://github.com/MichaIng/DietPi/issues/3098
(( $G_DIETPI_INSTALL_STAGE == 1 )) && G_AGDUG

# Generate dir for dietpi-software installed "non-service" based control scripts
mkdir -p /var/lib/dietpi/dietpi-software/services
Expand Down Expand Up @@ -14514,32 +14505,32 @@ _EOF_
# DietPi-Automation
if (( $G_DIETPI_INSTALL_STAGE == 1 )); then

# - Remove fake-hwclock, if real hwclock is available
# Remove fake-hwclock, if real hwclock is available
# REMOVED: Needs further work as SBCs without RTC (XU4/Sparky SBC) are being flagged for this removal
#hwclock &> /dev/null && G_AGP fake-hwclock

# - x86_64 microcode installation
# x86_64 microcode installation
if (( $G_HW_ARCH == 10 )); then

grep -qi 'vendor_id.*intel' /proc/cpuinfo && G_AGI intel-microcode
grep -qi 'vendor_id.*amd' /proc/cpuinfo && G_AGI amd64-microcode

fi

# - Custom 1st run Script (Local file)
# Custom 1st run Script (Local file)
local run_custom_script=0
if [[ -f '/boot/Automation_Custom_Script.sh' ]]; then

cp /boot/Automation_Custom_Script.sh /root/AUTO_CustomScript.sh
run_custom_script=1

# - Custom 1st run Script (Online file)
elif [[ $AUTOINSTALL_CUSTOMSCRIPTURL != '0' ]]; then
# Custom 1st run Script (Online file)
elif [[ $AUTOINSTALL_CUSTOMSCRIPTURL ]]; then

INSTALL_URL_ADDRESS=$AUTOINSTALL_CUSTOMSCRIPTURL
G_CHECK_URL "$INSTALL_URL_ADDRESS"

#Get script and execute
# Get script and execute
wget "$INSTALL_URL_ADDRESS" -O /root/AUTO_CustomScript.sh
run_custom_script=1

Expand Down Expand Up @@ -14579,24 +14570,25 @@ _EOF_
#/////////////////////////////////////////////////////////////////////////////////////
# First Run / Automation functions Vars (eg: on a fresh install)
#/////////////////////////////////////////////////////////////////////////////////////
AUTOINSTALL_ENABLED=0
AUTOINSTALL_SSHINDEX=0
AUTOINSTALL_FILESERVERINDEX=0
AUTOINSTALL_LOGGINGINDEX=0
AUTOINSTALL_WEBSERVERINDEX=0
AUTOINSTALL_AUTOSTARTTARGET=0
AUTOINSTALL_CUSTOMSCRIPTURL=0

FirstRun_Automation_Init(){

# Get settings
AUTOINSTALL_ENABLED=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_AUTOMATED=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_AUTOSTARTTARGET=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_AUTOSTART_TARGET_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//' )
AUTOINSTALL_SSHINDEX=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_SSH_SERVER_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_FILESERVERINDEX=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_FILE_SERVER_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_LOGGINGINDEX=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_LOGGING_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_WEBSERVERINDEX=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_WEB_SERVER_INDEX=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_CUSTOMSCRIPTURL=$(grep -m1 '^[[:blank:]]*AUTO_SETUP_CUSTOM_SCRIPT_EXEC=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
AUTOINSTALL_ENABLED=$(sed -n '/^[[:blank:]]*AUTO_SETUP_AUTOMATED=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_AUTOSTARTTARGET=$(sed -n '/^[[:blank:]]*AUTO_SETUP_AUTOSTART_TARGET_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_SSHINDEX=$(sed -n '/^[[:blank:]]*AUTO_SETUP_SSH_SERVER_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_FILESERVERINDEX=$(sed -n '/^[[:blank:]]*AUTO_SETUP_FILE_SERVER_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_LOGGINGINDEX=$(sed -n '/^[[:blank:]]*AUTO_SETUP_LOGGING_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_WEBSERVERINDEX=$(sed -n '/^[[:blank:]]*AUTO_SETUP_WEB_SERVER_INDEX=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_CUSTOMSCRIPTURL=$(sed -n '/^[[:blank:]]*AUTO_SETUP_CUSTOM_SCRIPT_EXEC=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
AUTOINSTALL_TIMESYNCMODE=$(sed -n '/^[[:blank:]]*CONFIG_NTP_MODE=/{s/^[^=]*=//p;q}' /DietPi/dietpi.txt)
# Else set defaults
[[ $AUTOINSTALL_ENABLED ]] || AUTOINSTALL_ENABLED=0
[[ $AUTOINSTALL_AUTOSTARTTARGET ]] || AUTOINSTALL_AUTOSTARTTARGET=0
[[ $AUTOINSTALL_SSHINDEX ]] || AUTOINSTALL_SSHINDEX=0
[[ $AUTOINSTALL_FILESERVERINDEX ]] || AUTOINSTALL_FILESERVERINDEX=0
[[ $AUTOINSTALL_LOGGINGINDEX ]] || AUTOINSTALL_LOGGINGINDEX=0
[[ $AUTOINSTALL_WEBSERVERINDEX ]] || AUTOINSTALL_WEBSERVERINDEX=0
[[ $AUTOINSTALL_TIMESYNCMODE ]] || AUTOINSTALL_TIMESYNCMODE=2

}

Expand All @@ -14614,7 +14606,7 @@ _EOF_
while read -r software_id
do

# - Flag for installation
# Flag for installation
if [[ ${aSOFTWARE_NAME[$software_id]} ]]; then

aSOFTWARE_INSTALL_STATE[$software_id]=1
Expand All @@ -14633,7 +14625,10 @@ _EOF_
INDEX_WEBSERVER_TARGET=$AUTOINSTALL_WEBSERVERINDEX

# Re-flag RAMlog for install, if enabled, ensures AUTO_SETUP_RAMLOG_MAXSIZE gets applied
(( $INDEX_LOGGING_TARGET == -1 || $INDEX_LOGGING_TARGET == -2 )) && aSOFTWARE_INSTALL_STATE[103]=1
[[ $INDEX_LOGGING_TARGET == -[12] ]] && aSOFTWARE_INSTALL_STATE[103]=1

# Set time sync mode
/DietPi/dietpi/func/dietpi-set_software ntpd-mode $AUTOINSTALL_TIMESYNCMODE

}

Expand Down Expand Up @@ -14890,10 +14885,10 @@ _EOF_
# Generate Whiptail menu list, of all items in specific software type, based on category
else

# - Prewarnings - Linux
# Prewarnings - Linux
if (( $input_mode == 1 )); then

# Inform User that DietPi software will automatically install additional linux software when required.
# Inform User that DietPi software will automatically install additional linux software when required.
if (( ! $USER_LINUX_AUTOINSTALL_PROMPT_DISPLAYED )); then

G_WHIP_MSG 'DietPi will automatically install additional Linux software on the next screen, when required (eg: Desktop LXDE will install ALSA + Xserver).\n\nThis means you only need to select the software you actually require.'
Expand Down Expand Up @@ -16000,27 +15995,27 @@ Do you wish to continue with DietPi as a pure minimal image?'; then
# 1st run dietpi-software
if (( $G_DIETPI_INSTALL_STAGE == 1 )); then

# - Load all automation vars
# Load all automation vars
FirstRun_Automation_Init

# - Global PW
# Automation, apply as per dietpi.txt
# Global PW
# - Automation, apply as per dietpi.txt
if (( $AUTOINSTALL_ENABLED )); then

/DietPi/dietpi/func/dietpi-set_software passwords "$GLOBAL_PW"

# Prompt change global password and login passwords for root and dietpi users
# - Prompt change global password and login passwords for root and dietpi users
else

/DietPi/dietpi/func/dietpi-set_software passwords
Update_Global_Pw

fi

# - Disable serial? Must stay enabled for the following:
# XU4: HC1/HC2 fail to boot into kernel without: https://github.com/MichaIng/DietPi/issues/2038#issuecomment-416089875
# RockPro64: Fails to boot into kernel without
# NanoPi Neo Air: Required for end users/debugging/setting up WiFi without automation
# Disable serial? Must stay enabled for the following:
# - XU4: HC1/HC2 fail to boot into kernel without: https://github.com/MichaIng/DietPi/issues/2038#issuecomment-416089875
# - RockPro64: Fails to boot into kernel without
# - NanoPi Neo Air: Required for end users/debugging/setting up WiFi without automation
if grep -q '^[[:blank:]]*CONFIG_SERIAL_CONSOLE_ENABLE=1' /DietPi/dietpi.txt &&
(( $G_HW_MODEL != 11 && $G_HW_MODEL != 42 && $G_HW_MODEL != 64 )) &&
G_WHIP_YESNO 'Serial console is currently enabled, would you like to disable it?\n - Disabling serial console will reduce memory consumption slightly\n - If you are unsure on what serial console is, it is safe to disable it'; then
Expand All @@ -16031,7 +16026,7 @@ Do you wish to continue with DietPi as a pure minimal image?'; then

fi

# Prevent continue if no Network or NTPD is not completed: https://github.com/MichaIng/DietPi/issues/786
# Prevent continue if no network or time sync is not completed: https://github.com/MichaIng/DietPi/issues/786
Check_Internet_and_NTPD

# Apply 1st run automation
Expand Down

0 comments on commit b81bee4

Please sign in to comment.