diff --git a/scripts/check_first_login.sh b/scripts/check_first_login.sh index 90e35d550..eaaf783ff 100644 --- a/scripts/check_first_login.sh +++ b/scripts/check_first_login.sh @@ -2,6 +2,7 @@ # only do this for interactive shells if [ "$-" != "${-#*i}" ]; then if [ -f "$HOME/.not_logged_in_yet" ]; then + echo "" echo -e "\e[0;31mThank you for choosing Armbian. Support: www.armbian.com\x1B[0m" echo "" rm -f "$HOME/.not_logged_in_yet" diff --git a/scripts/check_first_login_reboot.sh b/scripts/check_first_login_reboot.sh index 51127dc15..93852fcf0 100644 --- a/scripts/check_first_login_reboot.sh +++ b/scripts/check_first_login_reboot.sh @@ -2,6 +2,7 @@ # only do this for interactive shells if [ "$-" != "${-#*i}" ]; then if [ -f "/tmp/.reboot_required" ]; then + echo "" echo -e "[\e[0;91m Kernel was updated, please reboot!\x1B[0m ]" echo "" rm "/tmp/.reboot_required" diff --git a/scripts/firstrun b/scripts/firstrun index 988e0d2e6..466f56cb3 100644 --- a/scripts/firstrun +++ b/scripts/firstrun @@ -12,7 +12,6 @@ # starting at first time. # regenerate ssh host key ### END INIT INFO - # # Create this file to speed up boot process # @@ -21,8 +20,9 @@ cat > /tmp/create_swap.sh </dev/null 2>&1 chown root:root /var/swap chmod 0600 /var/swap @@ -42,7 +42,7 @@ fi if [[ "$(apt-cache policy ramlog | grep Installed)" != "" ]]; then service ramlog enable # if we have 1G ram reduce RAMLOG size - if [[ "$MEMTOTAL" -le "1" ]]; then + if [[ "\$MEMTOTAL" -le "1" ]]; then if [ -f "/etc/default/ramlog" ]; then sed -e 's/TMPFS_RAMFS_SIZE=512m/TMPFS_RAMFS_SIZE=256m/g' -i /etc/default/ramlog fi @@ -96,7 +96,8 @@ do_expand_rootfs(){ fsck -f $root_partition >/dev/null 2>&1 || true partprobe $device >/dev/null 2>&1 || s=$? resize2fs $root_partition >/dev/null 2>&1 || true - if [[ "$DISTRIBUTION" == "wheezy" || "$s" != "0" ]]; then + FREESIZE=$(df -hm / | awk '/\// {print $(NF-2)}') + if [[ "$DISTRIBUTION" == "wheezy" || "$s" != "0" || "$FREESIZE" -lt "152" ]]; then touch /var/run/reboot display_alert "Automatic reboot is needed. Please wait" update-rc.d resize2fs defaults >/dev/null 2>&1 diff --git a/scripts/resize2fs b/scripts/resize2fs index fe8cd3370..051975e7e 100644 --- a/scripts/resize2fs +++ b/scripts/resize2fs @@ -31,6 +31,15 @@ case "$1" in if [[ $rootfstype == ext4 && ! -f "/root/.no_rootfs_resize" ]]; then /sbin/resize2fs $device >/dev/null 2>&1 fi + if [[ ! -f "/var/swap" ]]; then + dd if=/dev/zero of=/var/swap bs=1024 count=131072 status=noxfer >/dev/null 2>&1 + chown root:root /var/swap + chmod 0600 /var/swap + mkswap /var/swap >/dev/null 2>&1 + swapon /var/swap >/dev/null 2>&1 + if ! grep -q swap /etc/fstab; then echo "/var/swap none swap sw 0 0" >> /etc/fstab; fi + if ! grep -q swap /etc/sysctl.conf; then echo "vm.swappiness=0" >> /etc/sysctl.conf; fi + fi update-rc.d -f resize2fs remove >/dev/null 2>&1 ;; *)