]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blobdiff - src/initscripts/system/partresize
Merge branch 'master' into next
[people/mfischer/ipfire-2.x.git] / src / initscripts / system / partresize
index f3e3c0f0d1ab3aaa657ff6c52b473f5cecac8068..7605b9e2b15a618f949741687e97d8fe0ff16e20 100644 (file)
@@ -1,16 +1,23 @@
 #!/bin/sh
-########################################################################
-# Begin $rc_base/init.d/partresize
-#
-# Description : Resize the root partition to the drivesize
-#
-# Authors     : Arne Fitzenreiter - arne_f@ipfire.org
-#
-# Version     : 1.04
-#
-# Notes       :
-#
-########################################################################
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 . /etc/sysconfig/rc
 . ${rc_functions}
@@ -34,14 +41,44 @@ case "${1}" in
                        if [ ! "$(grep "console=ttyS0" /proc/cmdline)" == "" ]; then
                                scon="on";
                        fi
-                       IFS= read -r DMI_PRODUCT_NAME < /sys/class/dmi/id/product_name;
-                       case ${DMI_PRODUCT_NAME} in
-                               APU|apu[2-4]|PC\ Engines\ apu[1-4] )
-                                               scon="on";
-                                       ;;
-                       esac
+                       if [ -e /sys/class/dmi/id/product_name ]; then
+                               IFS= read -r DMI_PRODUCT_NAME < /sys/class/dmi/id/product_name;
+                               case ${DMI_PRODUCT_NAME} in
+                                       APU|apu[1-4]|PC\ Engines\ apu[1-4] )
+                                                       scon="on";
+                                               ;;
+                               esac
+                       fi
+
+                       # Enable the serial console on all systems on AWS EC2, Oracle Cloud,
+                       # Azure and Google Compute Platform
+                       if running_on_ec2 || running_on_oci || running_on_azure || running_on_gcp; then
+                               scon="on"
+                       fi
 
                        mount /boot > /dev/null
+                       case "$(< /proc/device-tree/model )" in
+                               FriendlyElec\ NanoPi?R1* )
+                                       # Install AP6112 wlan config on NanoPi R1
+                                       cp -f   /lib/firmware/brcm/brcmfmac43430-sdio.AP6212.txt \
+                                               /lib/firmware/brcm/brcmfmac43430-sdio.txt
+                                       cp -f   /lib/firmware/brcm/brcmfmac43430a0-sdio.ONDA-V80_PLUS.txt \
+                                               /lib/firmware/brcm/brcmfmac43430a0-sdio.txt
+                               ;;
+                               FriendlyElec\ NanoPi?R2* )
+                                       # Generate MAC address at first boot
+                                       SWMAC=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
+                                       echo ethaddr=$SWMAC:00 >> /boot/uEnv.txt
+                                       echo eth1addr=$SWMAC:01 >> /boot/uEnv.txt
+                               ;;
+                               FriendlyElec\ NanoPi?R4* )
+                                       # Generate MAC address at first boot
+                                       SWMAC=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
+                                       echo ethaddr=$SWMAC:00 >> /boot/uEnv.txt
+                                       echo eth1addr=$SWMAC:01 >> /boot/uEnv.txt
+                               ;;
+                       esac 2>/dev/null
+
                        if [ -e /boot/grub/grub.cfg ]; then
                                # swtich permanent to serial console if it was selected on first boot
                                if [ "${scon}" = "on" ]; then
@@ -99,5 +136,3 @@ case "${1}" in
                exit 1
                ;;
 esac
-
-# End $rc_base/init.d/partresize