Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recovery upgrades #445

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/cos/collection.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
packages:
- name: "cos"
category: "system"
version: 0.5.8+4
version: 0.5.8+6
description: "cOS base image, used to build cOS live ISOs"
brand_name: "cOS"
labels:
autobump.revdeps: "true"
autobump.revbump_related: "recovery/cos-img recovery/cos-squash"
- name: "cos"
category: "recovery"
version: 0.5.8+4
version: 0.5.8+6
brand_name: "cOS recovery"
description: "cOS recovery image, used to boot cOS for troubleshooting"
labels:
autobump.revdeps: "true"
autobump.revbump_related: "recovery/cos-img recovery/cos-squash"
- name: "cos-container"
category: "system"
version: 0.5.8+5
version: 0.5.8+6
brand_name: "cOS"
description: "cOS container image, used to build cOS derivatives from scratch"
labels:
Expand Down
2 changes: 1 addition & 1 deletion packages/cos/recovery-img/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "cos-img"
category: "recovery"
version: 0.5.8+5
version: 0.5.8+6
brand_name: "cOS"
2 changes: 1 addition & 1 deletion packages/cos/recovery-img/squash/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: "cos-squash"
category: "recovery"
version: 0.5.8+5
version: 0.5.8+6
2 changes: 1 addition & 1 deletion packages/installer/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: "installer"
category: "utils"
version: 0.8+9
version: "0.9"
12 changes: 8 additions & 4 deletions packages/installer/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ find_upgrade_channel() {
source /etc/cos-upgrade-image
fi

if [ -n "$NO_CHANNEL" ] && [ $NO_CHANNEL == true ]; then
CHANNEL_UPGRADES=false
fi

if [ -n "$IMAGE" ]; then
UPGRADE_IMAGE=$IMAGE
echo "Upgrading to image $UPGRADE_IMAGE"
Expand Down Expand Up @@ -184,12 +188,10 @@ usage()
exit 1
}

find_upgrade_channel

while [ "$#" -gt 0 ]; do
case $1 in
--docker-image)
CHANNEL_UPGRADES=false
NO_CHANNEL=true
;;
--no-verify)
VERIFY=false
Expand All @@ -207,13 +209,15 @@ while [ "$#" -gt 0 ]; do
if [ "$#" -gt 2 ]; then
usage
fi
UPGRADE_IMAGE=$1
IMAGE=$1
break
;;
esac
shift 1
done

find_upgrade_channel

trap cleanup exit


Expand Down
28 changes: 16 additions & 12 deletions packages/installer/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,22 @@ find_upgrade_channel() {
source /etc/cos-upgrade-image
fi

if [ -n "$NO_CHANNEL" ] && [ $NO_CHANNEL == true ]; then
CHANNEL_UPGRADES=false
fi

if [ -n "$IMAGE" ]; then
UPGRADE_IMAGE=$IMAGE
echo "Upgrading to image $UPGRADE_IMAGE"
fi
else

if [ -z "$UPGRADE_IMAGE" ]; then
UPGRADE_IMAGE="system/cos"
fi
if [ -z "$UPGRADE_IMAGE" ]; then
UPGRADE_IMAGE="system/cos"
fi

if [ -n "$UPGRADE_RECOVERY" ] && [ $UPGRADE_RECOVERY == true ] && [ -n "$RECOVERY_IMAGE" ]; then
UPGRADE_IMAGE=$RECOVERY_IMAGE
if [ -n "$UPGRADE_RECOVERY" ] && [ $UPGRADE_RECOVERY == true ] && [ -n "$RECOVERY_IMAGE" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPGRADE_RECOVERY was not set here since it gets applied in from the command line parsing which used to happen after this method in former implementation. Hence the recovery image from /etc/cos-upgrade-image was never applied and it was defaulting to system/cos

UPGRADE_IMAGE=$RECOVERY_IMAGE
fi
fi
}

Expand Down Expand Up @@ -264,15 +269,13 @@ usage()
exit 1
}

find_upgrade_channel

while [ "$#" -gt 0 ]; do
case $1 in
--docker-image)
CHANNEL_UPGRADES=false
NO_CHANNEL=true
;;
--directory)
CHANNEL_UPGRADES=false
NO_CHANNEL=true
DIRECTORY=true
;;
--recovery)
Expand All @@ -292,13 +295,15 @@ while [ "$#" -gt 0 ]; do
usage
fi
INTERACTIVE=true
UPGRADE_IMAGE=$1
IMAGE=$1
break
;;
esac
shift 1
done

find_upgrade_channel

trap cleanup exit

if [ -n "$UPGRADE_RECOVERY" ] && [ $UPGRADE_RECOVERY == true ]; then
Expand Down Expand Up @@ -327,7 +332,6 @@ fi

echo "Flush changes to disk"
sync
sync

if [ -n "$INTERACTIVE" ] && [ $INTERACTIVE == false ]; then
if grep -q 'cos.upgrade.power_off=true' /proc/cmdline; then
Expand Down