core121: Create updater
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 6 Jun 2018 13:01:18 +0000 (14:01 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 6 Jun 2018 13:03:07 +0000 (14:03 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
43 files changed:
config/rootfiles/core/121/filelists/acpid [new symlink]
config/rootfiles/core/121/filelists/apache2 [new symlink]
config/rootfiles/core/121/filelists/apr [new symlink]
config/rootfiles/core/121/filelists/aprutil [new symlink]
config/rootfiles/core/121/filelists/armv5tel/files [new file with mode: 0644]
config/rootfiles/core/121/filelists/armv5tel/linux-initrd-kirkwood [new symlink]
config/rootfiles/core/121/filelists/armv5tel/linux-initrd-multi [new symlink]
config/rootfiles/core/121/filelists/armv5tel/linux-initrd-rpi [new symlink]
config/rootfiles/core/121/filelists/armv5tel/linux-kirkwood [new symlink]
config/rootfiles/core/121/filelists/armv5tel/linux-multi [new symlink]
config/rootfiles/core/121/filelists/armv5tel/linux-rpi [new symlink]
config/rootfiles/core/121/filelists/armv5tel/rpi-firmware [new symlink]
config/rootfiles/core/121/filelists/armv5tel/u-boot [new symlink]
config/rootfiles/core/121/filelists/armv5tel/u-boot-kirkwood [new symlink]
config/rootfiles/core/121/filelists/armv5tel/u-boot-mkimage [new symlink]
config/rootfiles/core/121/filelists/beep [new symlink]
config/rootfiles/core/121/filelists/ca-certificates [new symlink]
config/rootfiles/core/121/filelists/cmake [new symlink]
config/rootfiles/core/121/filelists/crda [new symlink]
config/rootfiles/core/121/filelists/dhcp [new symlink]
config/rootfiles/core/121/filelists/files
config/rootfiles/core/121/filelists/flex [new symlink]
config/rootfiles/core/121/filelists/i586/grub [new symlink]
config/rootfiles/core/121/filelists/i586/intel-microcode [new symlink]
config/rootfiles/core/121/filelists/i586/linux [new symlink]
config/rootfiles/core/121/filelists/i586/linux-initrd [new symlink]
config/rootfiles/core/121/filelists/iw [new symlink]
config/rootfiles/core/121/filelists/jwhois [new symlink]
config/rootfiles/core/121/filelists/linux-firmware [new symlink]
config/rootfiles/core/121/filelists/multipath-tools [new symlink]
config/rootfiles/core/121/filelists/openssl [new symlink]
config/rootfiles/core/121/filelists/rng-tools [new symlink]
config/rootfiles/core/121/filelists/tar [new symlink]
config/rootfiles/core/121/filelists/unbound [new symlink]
config/rootfiles/core/121/filelists/wget [new symlink]
config/rootfiles/core/121/filelists/x86_64/grub [new symlink]
config/rootfiles/core/121/filelists/x86_64/intel-microcode [new symlink]
config/rootfiles/core/121/filelists/x86_64/linux [new symlink]
config/rootfiles/core/121/filelists/x86_64/linux-initrd [new symlink]
config/rootfiles/core/121/filelists/xr819-firmware [new symlink]
config/rootfiles/core/121/filelists/xtables-addons [new symlink]
config/rootfiles/core/121/filelists/xz [new symlink]
config/rootfiles/core/121/update.sh

diff --git a/config/rootfiles/core/121/filelists/acpid b/config/rootfiles/core/121/filelists/acpid
new file mode 120000 (symlink)
index 0000000..73f1b7b
--- /dev/null
@@ -0,0 +1 @@
+../../../common/acpid
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/apache2 b/config/rootfiles/core/121/filelists/apache2
new file mode 120000 (symlink)
index 0000000..eef95ef
--- /dev/null
@@ -0,0 +1 @@
+../../../common/apache2
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/apr b/config/rootfiles/core/121/filelists/apr
new file mode 120000 (symlink)
index 0000000..87dd197
--- /dev/null
@@ -0,0 +1 @@
+../../../common/apr
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/aprutil b/config/rootfiles/core/121/filelists/aprutil
new file mode 120000 (symlink)
index 0000000..999f9f8
--- /dev/null
@@ -0,0 +1 @@
+../../../common/aprutil
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/files b/config/rootfiles/core/121/filelists/armv5tel/files
new file mode 100644 (file)
index 0000000..d2712ba
--- /dev/null
@@ -0,0 +1 @@
+etc/rc.d/init.d/swconfig
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-kirkwood b/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-kirkwood
new file mode 120000 (symlink)
index 0000000..39c5591
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-initrd-kirkwood
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-multi b/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-multi
new file mode 120000 (symlink)
index 0000000..0b1b453
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-initrd-multi
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-rpi b/config/rootfiles/core/121/filelists/armv5tel/linux-initrd-rpi
new file mode 120000 (symlink)
index 0000000..8281067
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-initrd-rpi
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-kirkwood b/config/rootfiles/core/121/filelists/armv5tel/linux-kirkwood
new file mode 120000 (symlink)
index 0000000..7217107
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-kirkwood
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-multi b/config/rootfiles/core/121/filelists/armv5tel/linux-multi
new file mode 120000 (symlink)
index 0000000..204eb4c
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-multi
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/linux-rpi b/config/rootfiles/core/121/filelists/armv5tel/linux-rpi
new file mode 120000 (symlink)
index 0000000..a651a49
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/linux-rpi
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/rpi-firmware b/config/rootfiles/core/121/filelists/armv5tel/rpi-firmware
new file mode 120000 (symlink)
index 0000000..428fdf8
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/rpi-firmware
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/u-boot b/config/rootfiles/core/121/filelists/armv5tel/u-boot
new file mode 120000 (symlink)
index 0000000..3df31a8
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/u-boot
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/u-boot-kirkwood b/config/rootfiles/core/121/filelists/armv5tel/u-boot-kirkwood
new file mode 120000 (symlink)
index 0000000..eebbdb1
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/u-boot-kirkwood
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/armv5tel/u-boot-mkimage b/config/rootfiles/core/121/filelists/armv5tel/u-boot-mkimage
new file mode 120000 (symlink)
index 0000000..65fe960
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/armv5tel/u-boot-mkimage
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/beep b/config/rootfiles/core/121/filelists/beep
new file mode 120000 (symlink)
index 0000000..6db094e
--- /dev/null
@@ -0,0 +1 @@
+../../../common/beep
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/ca-certificates b/config/rootfiles/core/121/filelists/ca-certificates
new file mode 120000 (symlink)
index 0000000..320fea8
--- /dev/null
@@ -0,0 +1 @@
+../../../common/ca-certificates
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/cmake b/config/rootfiles/core/121/filelists/cmake
new file mode 120000 (symlink)
index 0000000..491d25f
--- /dev/null
@@ -0,0 +1 @@
+../../../common/cmake
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/crda b/config/rootfiles/core/121/filelists/crda
new file mode 120000 (symlink)
index 0000000..d68c46e
--- /dev/null
@@ -0,0 +1 @@
+../../../common/crda
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/dhcp b/config/rootfiles/core/121/filelists/dhcp
new file mode 120000 (symlink)
index 0000000..32d8da4
--- /dev/null
@@ -0,0 +1 @@
+../../../common/dhcp
\ No newline at end of file
index fc07ad7..a0bb942 100644 (file)
@@ -1,6 +1,20 @@
 etc/system-release
 etc/issue
+etc/rc.d/init.d/acpid
+etc/rc.d/init.d/collectd
+etc/rc.d/init.d/firstsetup
+etc/rc.d/init.d/leds
+etc/rc.d/init.d/partresize
+etc/rc.d/init.d/rngd
+etc/rc.d/rc0.d/K87acpid
+etc/rc.d/rc3.d/S12acpid
+etc/rc.d/rc6.d/K87acpid
 etc/ssl/certs/ca-bundle.crt
+srv/web/ipfire/cgi-bin/entropy.cgi
+srv/web/ipfire/cgi-bin/firewall.cgi
+srv/web/ipfire/cgi-bin/fwhosts.cgi
 srv/web/ipfire/cgi-bin/ovpnmain.cgi
 srv/web/ipfire/cgi-bin/remote.cgi
+usr/lib/firewall/firewall-lib.pl
 var/ipfire/langs
+var/ipfire/qos/bin/makeqosscripts.pl
diff --git a/config/rootfiles/core/121/filelists/flex b/config/rootfiles/core/121/filelists/flex
new file mode 120000 (symlink)
index 0000000..feb0390
--- /dev/null
@@ -0,0 +1 @@
+../../../common/flex
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/i586/grub b/config/rootfiles/core/121/filelists/i586/grub
new file mode 120000 (symlink)
index 0000000..feb236a
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/i586/grub
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/i586/intel-microcode b/config/rootfiles/core/121/filelists/i586/intel-microcode
new file mode 120000 (symlink)
index 0000000..f03e847
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/i586/intel-microcode
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/i586/linux b/config/rootfiles/core/121/filelists/i586/linux
new file mode 120000 (symlink)
index 0000000..693ec4b
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/i586/linux
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/i586/linux-initrd b/config/rootfiles/core/121/filelists/i586/linux-initrd
new file mode 120000 (symlink)
index 0000000..32a03e6
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/i586/linux-initrd
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/iw b/config/rootfiles/core/121/filelists/iw
new file mode 120000 (symlink)
index 0000000..7c58a20
--- /dev/null
@@ -0,0 +1 @@
+../../../common/iw
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/jwhois b/config/rootfiles/core/121/filelists/jwhois
new file mode 120000 (symlink)
index 0000000..b984a7f
--- /dev/null
@@ -0,0 +1 @@
+../../../common/jwhois
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/linux-firmware b/config/rootfiles/core/121/filelists/linux-firmware
new file mode 120000 (symlink)
index 0000000..4bf91bc
--- /dev/null
@@ -0,0 +1 @@
+../../../common/linux-firmware
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/multipath-tools b/config/rootfiles/core/121/filelists/multipath-tools
new file mode 120000 (symlink)
index 0000000..9ff6323
--- /dev/null
@@ -0,0 +1 @@
+../../../common/multipath-tools
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/openssl b/config/rootfiles/core/121/filelists/openssl
new file mode 120000 (symlink)
index 0000000..e011a92
--- /dev/null
@@ -0,0 +1 @@
+../../../common/openssl
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/rng-tools b/config/rootfiles/core/121/filelists/rng-tools
new file mode 120000 (symlink)
index 0000000..a7853e4
--- /dev/null
@@ -0,0 +1 @@
+../../../common/rng-tools
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/tar b/config/rootfiles/core/121/filelists/tar
new file mode 120000 (symlink)
index 0000000..3e585d2
--- /dev/null
@@ -0,0 +1 @@
+../../../common/tar
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/unbound b/config/rootfiles/core/121/filelists/unbound
new file mode 120000 (symlink)
index 0000000..66adf09
--- /dev/null
@@ -0,0 +1 @@
+../../../common/unbound
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/wget b/config/rootfiles/core/121/filelists/wget
new file mode 120000 (symlink)
index 0000000..fcb57df
--- /dev/null
@@ -0,0 +1 @@
+../../../common/wget
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/x86_64/grub b/config/rootfiles/core/121/filelists/x86_64/grub
new file mode 120000 (symlink)
index 0000000..78d3bd7
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/x86_64/grub
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/x86_64/intel-microcode b/config/rootfiles/core/121/filelists/x86_64/intel-microcode
new file mode 120000 (symlink)
index 0000000..d5ac074
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/x86_64/intel-microcode
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/x86_64/linux b/config/rootfiles/core/121/filelists/x86_64/linux
new file mode 120000 (symlink)
index 0000000..0615b5b
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/x86_64/linux
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/x86_64/linux-initrd b/config/rootfiles/core/121/filelists/x86_64/linux-initrd
new file mode 120000 (symlink)
index 0000000..1b9fff7
--- /dev/null
@@ -0,0 +1 @@
+../../../../common/x86_64/linux-initrd
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/xr819-firmware b/config/rootfiles/core/121/filelists/xr819-firmware
new file mode 120000 (symlink)
index 0000000..8b746ae
--- /dev/null
@@ -0,0 +1 @@
+../../../common/xr819-firmware
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/xtables-addons b/config/rootfiles/core/121/filelists/xtables-addons
new file mode 120000 (symlink)
index 0000000..2e24c42
--- /dev/null
@@ -0,0 +1 @@
+../../../common/xtables-addons
\ No newline at end of file
diff --git a/config/rootfiles/core/121/filelists/xz b/config/rootfiles/core/121/filelists/xz
new file mode 120000 (symlink)
index 0000000..734e926
--- /dev/null
@@ -0,0 +1 @@
+../../../common/xz
\ No newline at end of file
index 87d5f6e..76994d9 100644 (file)
 
 core=121
 
+exit_with_error() {
+       # Set last succesfull installed core.
+       echo $(($core-1)) > /opt/pakfire/db/core/mine
+       /usr/bin/logger -p syslog.emerg -t ipfire \
+               "core-update-${core}: $1"
+       exit $2
+}
+
 # Remove old core updates from pakfire cache to save space...
 for (( i=1; i<=$core; i++ )); do
        rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
 done
 
+# This update cannot be applied on ARM
+case "$(uname -a)" in
+       arm*)
+               exit_with_error "ERROR: Cannot update on ARM. Please re-install." 1
+               ;;
+esac
+
+# Do some sanity checks.
+case $(uname -r) in
+       *-ipfire*)
+               # Ok.
+               ;;
+       *)
+               exit_with_error "ERROR cannot update. No IPFire Kernel." 1
+               ;;
+esac
+
+# Check diskspace on root
+ROOTSPACE=`df / -Pk | sed "s| * | |g" | cut -d" " -f4 | tail -n 1`
+
+if [ $ROOTSPACE -lt 100000 ]; then
+       exit_with_error "ERROR cannot update because not enough free space on root." 2
+       exit 2
+fi
+
+# Remove the old kernel
+rm -rf /boot/System.map-*
+rm -rf /boot/config-*
+rm -rf /boot/ipfirerd-*
+rm -rf /boot/initramfs-*
+rm -rf /boot/vmlinuz-*
+rm -rf /boot/uImage-ipfire-*
+rm -rf /boot/zImage-ipfire-*
+rm -rf /boot/uInit-ipfire-*
+rm -rf /boot/dtb-*-ipfire-*
+rm -rf /lib/modules
+
 # Stop services
 
 # Extract files