1
0
mirror of https://github.com/rancher/os.git synced 2025-09-03 15:54:24 +00:00
Files
os/framework/files/usr/sbin/suc-upgrade
2021-11-03 22:06:28 -07:00

36 lines
825 B
Bash
Executable File

#!/bin/bash
set -x -e
HOST_DIR="${HOST_DIR:-/host}"
RELEASE_FILE="${RELEASE_FILE:-/usr/lib/rancheros-release}"
CONF_FILE="${CONF_FILE:-/run/data/cloud-config}"
function config()
{
if [ ! -e $CONF_FILE ]; then
return 0
fi
if [ ! -e ${HOST}/oem/90_operator.yaml ] || ! diff $CONF_FILE ${HOST}/oem/90/operator.yaml >/dev/null; then
cp -f $CONF_FILE ${HOST}/oem/90/operator.yaml
$REBOOT
fi
}
if [ "$FORCE" != "true" ]; then
if diff $RELEASE_FILE ${HOST_DIR}${RELEASE_FILE} >/dev/null; then
echo Update to date with
cat ${RELEASE_FILE}
REBOOT="nsenter -i -m -t 1 -- reboot"
config
exit 0
fi
fi
config
mount --rbind $HOST_DIR/dev /dev
mount --rbind $HOST_DIR/run /run
bash -x cos-upgrade --directory /
nsenter -i -m -t 1 -- reboot
exit 1