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

Prepare the update-manager for release #258

Merged
merged 1 commit into from
Aug 10, 2023
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
83 changes: 83 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,53 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# update-manager builds
- id: build-update-manager
dir: ./build-tmp/update-manager
main: ./cmd/update-manager
binary: update-manager/update-manager
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-update-manager-pkg
dir: ./build-tmp/update-manager
main: ./cmd/update-manager
binary: update-manager
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
archives:
- id: kanto-archive-all
name_template: '{{ .ProjectName }}_{{ .Version }}_linux_{{ if .Amd64 }}x86_64{{ else if .Arm }}armv7{{ else }}{{ .Runtime.Goarch }}{{ end }}'
Expand All @@ -445,6 +492,7 @@ archives:
- build-suite-bootstrapping
- build-file-backup
- build-system-metrics
- build-update-manager
files:
# common files
- LICENSE
Expand Down Expand Up @@ -511,6 +559,12 @@ archives:
strip_parent: true
info:
mode: 0644
# update-manager additional files
- src: ./build-tmp/update-manager/NOTICE.md
dst: update-manager
strip_parent: true
info:
mode: 0644
nfpms:
- builds:
- build-suite-connector-pkg
Expand All @@ -522,6 +576,7 @@ nfpms:
- build-suite-bootstrapping-pkg
- build-file-backup-pkg
- build-system-metrics-pkg
- build-update-manager-pkg
bindir: /usr/bin
file_name_template: '{{ .ProjectName }}_{{ .Version }}_linux_{{ if .Amd64 }}x86_64{{ else if .Arm }}armv7{{ else }}{{ .Runtime.Goarch }}{{ end }}'
maintainer: Contributors to the Eclipse Foundation, Kanto Project <[email protected]>
Expand Down Expand Up @@ -804,6 +859,34 @@ nfpms:
dst: /usr/share/doc/system-metrics/LICENSE
file_info:
mode: 0644
# update-manager additional resources
- src: ./build-tmp/update-manager/resources/update-manager.service
dst: /etc/systemd/system/update-manager.service
file_info:
mode: 0644
packager: deb
- src: ./build-tmp/update-manager/resources/update-manager.service
dst: /usr/lib/systemd/system/update-manager.service
file_info:
mode: 0644
packager: rpm
- src: ./build-tmp/update-manager/resources/config.json
dst: /etc/update-manager/config.json
type: config
file_info:
mode: 0644
- src: ./build-tmp/update-manager/NOTICE.md
dst: /usr/share/doc/update-manager/NOTICE.md
file_info:
mode: 0644
- src: ./build-tmp/update-manager/README.md
dst: /usr/share/doc/update-manager/README.md
file_info:
mode: 0644
- src: ./build-tmp/update-manager/LICENSE
dst: /usr/share/doc/update-manager/LICENSE
file_info:
mode: 0644
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
snapshot:
Expand Down
3 changes: 2 additions & 1 deletion build/80-kanto.preset
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ enable container-management.service
enable file-upload.service
enable software-update.service
enable file-backup.service
enable system-metrics.service
enable system-metrics.service
enable update-manager.service
15 changes: 15 additions & 0 deletions build/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'system-metrics.service' >/dev/null || true
fi

# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'update-manager.service' >/dev/null || true

# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'update-manager.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'update-manager.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'update-manager.service' >/dev/null || true
fi

fi
# End automatically added section
Expand All @@ -119,6 +133,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
deb-systemd-invoke $_dh_action 'software-update.service' >/dev/null || true
deb-systemd-invoke $_dh_action 'file-backup.service' >/dev/null || true
deb-systemd-invoke $_dh_action 'system-metrics.service' >/dev/null || true
deb-systemd-invoke $_dh_action 'update-manager.service' >/dev/null || true
fi
fi
# End automatically added section
2 changes: 2 additions & 0 deletions build/postinst_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
/usr/lib/systemd/systemd-update-helper install-system-units software-update.service || :
/usr/lib/systemd/systemd-update-helper install-system-units file-backup.service || :
/usr/lib/systemd/systemd-update-helper install-system-units system-metrics.service || :
/usr/lib/systemd/systemd-update-helper install-system-units update-manager.service || :

# Start the Kanto services if enabled
if [ -d /run/systemd/system ]; then
Expand All @@ -29,5 +30,6 @@ if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
systemctl is-enabled -q software-update.service && systemctl start software-update.service >/dev/null || :
systemctl is-enabled -q file-backup.service && systemctl start file-backup.service >/dev/null || :
systemctl is-enabled -q system-metrics.service && systemctl start system-metrics.service >/dev/null || :
systemctl is-enabled -q update-manager.service && systemctl start update-manager.service >/dev/null || :
fi
fi
3 changes: 3 additions & 0 deletions build/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ fi
# Automatically added by dh_systemd_enable/12.1.1bv2019.0b1
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask 'update-manager.service' >/dev/null || true
deb-systemd-helper mask 'system-metrics.service' >/dev/null || true
deb-systemd-helper mask 'file-backup.service' >/dev/null || true
deb-systemd-helper mask 'software-update.service' >/dev/null || true
Expand All @@ -19,6 +20,8 @@ fi

if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge 'update-manager.service' >/dev/null || true
deb-systemd-helper unmask 'update-manager.service' >/dev/null || true
deb-systemd-helper purge 'system-metrics.service' >/dev/null || true
deb-systemd-helper unmask 'system-metrics.service' >/dev/null || true
deb-systemd-helper purge 'file-backup.service' >/dev/null || true
Expand Down
1 change: 1 addition & 0 deletions build/postrm_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
/usr/lib/systemd/systemd-update-helper mark-restart-system-units software-update.service || :
/usr/lib/systemd/systemd-update-helper mark-restart-system-units file-backup.service || :
/usr/lib/systemd/systemd-update-helper mark-restart-system-units system-metrics.service || :
/usr/lib/systemd/systemd-update-helper mark-restart-system-units update-manager.service || :
fi

if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
Expand Down
5 changes: 2 additions & 3 deletions build/prerm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Automatically added by dh_systemd_start/12.1.1bv2019.0b1
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop 'update-manager.service' >/dev/null || true
deb-systemd-invoke stop 'system-metrics.service' >/dev/null || true
deb-systemd-invoke stop 'file-backup.service' >/dev/null || true
deb-systemd-invoke stop 'software-update.service' >/dev/null || true
Expand All @@ -8,5 +8,4 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop 'suite-bootstrapping.service' >/dev/null || true
deb-systemd-invoke stop 'local-digital-twins.service' >/dev/null || true
deb-systemd-invoke stop 'suite-connector.service' >/dev/null || true
fi
# End automatically added section
fi
1 change: 1 addition & 0 deletions build/prerm_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
# Package removal, not upgrade

# Remove the Kanto services, including ones that are usually disabled by default
/usr/lib/systemd/systemd-update-helper remove-system-units update-manager.service || :
/usr/lib/systemd/systemd-update-helper remove-system-units system-metrics.service || :
/usr/lib/systemd/systemd-update-helper remove-system-units file-backup.service || :
/usr/lib/systemd/systemd-update-helper remove-system-units software-update.service || :
Expand Down