diff --git a/packages/system/suc-upgrade/build.yaml b/packages/system/suc-upgrade/build.yaml new file mode 100644 index 0000000..016d62e --- /dev/null +++ b/packages/system/suc-upgrade/build.yaml @@ -0,0 +1,4 @@ +image: "alpine" + +steps: +- cp -rfv suc-upgrade.sh /usr/sbin/suc-upgrade && chmod +x /usr/sbin/suc-upgrade \ No newline at end of file diff --git a/packages/system/suc-upgrade/definition.yaml b/packages/system/suc-upgrade/definition.yaml new file mode 100644 index 0000000..bdff0d9 --- /dev/null +++ b/packages/system/suc-upgrade/definition.yaml @@ -0,0 +1,3 @@ +name: "suc-upgrade" +category: "system" +version: "0.1" \ No newline at end of file diff --git a/packages/system/suc-upgrade/suc-upgrade.sh b/packages/system/suc-upgrade/suc-upgrade.sh new file mode 100644 index 0000000..38db2e3 --- /dev/null +++ b/packages/system/suc-upgrade/suc-upgrade.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -x -e +HOST_DIR="${HOST_DIR:-/host}" + +if [ "$FORCE" != "true" ]; then + if diff /etc/os-release $HOST_DIR/etc/os-release >/dev/null; then + echo Update to date with + cat /etc/os-release + exit 0 + fi +fi + +mount --rbind $HOST_DIR/dev /dev +mount --rbind $HOST_DIR/run /run +elemental upgrade --directory / +nsenter -i -m -t 1 -- reboot +exit 1 \ No newline at end of file