@@ -781,22 +781,33 @@ refactor_rootfs() {
781781 sed -i " s|IMAGE_TYPE=.*|IMAGE_TYPE=stable|g" ${armbian_release_file}
782782 }
783783
784- # Disable tips of the day for [ /etc/update-motd.d/35-armbian-tips ]
785- motd_tips=" etc/default/armbian-motd"
786- [[ -f " ${motd_tips} " ]] && sed -i ' s|^MOTD_DISABLE=.*|MOTD_DISABLE="tips"|g' ${motd_tips}
787- quotes_cron=" etc/cron.weekly/armbian-quotes"
788- [[ -f " ${quotes_cron} " ]] && sed -i " s|^curl |#curl |g" ${quotes_cron}
789-
790- # Make the .bashrc take effect, Default shell settings file: /etc/default/useradd
791- echo ' [[ "${SHELL}" == *bash && -f "${HOME}/.bashrc" ]] && . ${HOME}/.bashrc' >> etc/profile
792-
793784 # Add custom startup script
794785 custom_startup_script=" etc/custom_service/start_service.sh"
795786 [[ -f " ${custom_startup_script} " && -f " etc/rc.local" ]] && {
796787 chmod +x ${custom_startup_script}
797788 sed -i ' /^exit 0/i\bash /etc/custom_service/start_service.sh' etc/rc.local
798789 }
799790
791+ # Enable ssh service
792+ ssh_config=" etc/ssh/sshd_config"
793+ [[ -f " ${ssh_config} " ]] && {
794+ sed -i " s|^#*Port .*|Port 22|g" ${ssh_config}
795+ sed -i " s|^#*PermitRootLogin .*|PermitRootLogin yes|g" ${ssh_config}
796+ }
797+
798+ # Adjust the default timeout for service start/stop
799+ system_conf=" etc/systemd/system.conf"
800+ [[ -f " ${system_conf} " ]] && {
801+ sed -i " s|^#*DefaultTimeoutStartSec.*|DefaultTimeoutStartSec=10s|g" ${system_conf}
802+ sed -i " s|^#*DefaultTimeoutStopSec.*|DefaultTimeoutStopSec=10s|g" ${system_conf}
803+ }
804+
805+ # Disable tips of the day for [ /etc/update-motd.d/35-armbian-tips ]
806+ motd_tips=" etc/default/armbian-motd"
807+ [[ -f " ${motd_tips} " ]] && sed -i ' s|^MOTD_DISABLE=.*|MOTD_DISABLE="tips"|g' ${motd_tips}
808+ quotes_cron=" etc/cron.weekly/armbian-quotes"
809+ [[ -f " ${quotes_cron} " ]] && sed -i " s|^curl |#curl |g" ${quotes_cron}
810+
800811 # Add custom disabled alias extension load modules
801812 custom_blacklist=" etc/modprobe.d/blacklist.conf"
802813 [[ -f " ${custom_blacklist} " ]] || echo -e " # This file lists the disabled alias extension load modules." > ${custom_blacklist}
@@ -805,12 +816,8 @@ refactor_rootfs() {
805816 echo -e " blacklist btmtksdio" >> ${custom_blacklist}
806817 }
807818
808- # Enable ssh service
809- ssh_config=" etc/ssh/sshd_config"
810- [[ -f " ${ssh_config} " ]] && {
811- sed -i " s|^#*Port .*|Port 22|g" ${ssh_config}
812- sed -i " s|^#*PermitRootLogin .*|PermitRootLogin yes|g" ${ssh_config}
813- }
819+ # Make the .bashrc take effect, Default shell settings file: /etc/default/useradd
820+ echo ' [[ "${SHELL}" == *bash && -f "${HOME}/.bashrc" ]] && . ${HOME}/.bashrc' >> etc/profile
814821
815822 # Renaming/disabling related files
816823 mv -f etc/udev/rules.d/hdmi.rules etc/udev/rules.d/hdmi.rules.bak 2> /dev/null
@@ -820,11 +827,11 @@ refactor_rootfs() {
820827
821828 # Reduce network latency [ A start job is running for raise network interfaces (5 mins 1 sec) ]
822829 network_service=" usr/lib/systemd/system/networking.service"
823- sed -i " s|TimeoutStartSec=.*|TimeoutStartSec=10sec|g" ${network_service}
830+ sed -i " s|^#* TimeoutStartSec=.*|TimeoutStartSec=10sec|g" ${network_service}
824831
825832 # Add tasks that need to be executed on initial startup
826833 armbian_firstrun=" usr/lib/armbian/armbian-firstrun"
827- sed -i ' /armbian-release/i\[ -f "/usr/sbin/armbian-fix" ] && . /usr/sbin/armbian-fix' ${armbian_firstrun}
834+ sed -i ' /\/etc\/ armbian-release/i\[[ -x "/usr/sbin/armbian-fix" ] ] && . /usr/sbin/armbian-fix' ${armbian_firstrun}
828835
829836 # Fix abnormal CPU temperature
830837 temp_file=" usr/lib/armbian/armbian-allwinner-battery"
0 commit comments