diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 823a5dfc..6b5a2cba 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 }}' @@ -445,6 +492,7 @@ archives: - build-suite-bootstrapping - build-file-backup - build-system-metrics + - build-update-manager files: # common files - LICENSE @@ -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 @@ -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 @@ -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: diff --git a/build/80-kanto.preset b/build/80-kanto.preset index 65a2ca06..fe26fdb3 100644 --- a/build/80-kanto.preset +++ b/build/80-kanto.preset @@ -10,4 +10,5 @@ enable container-management.service enable file-upload.service enable software-update.service enable file-backup.service -enable system-metrics.service \ No newline at end of file +enable system-metrics.service +enable update-manager.service \ No newline at end of file diff --git a/build/postinst b/build/postinst index 0b246464..bfc715fe 100644 --- a/build/postinst +++ b/build/postinst @@ -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 @@ -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 diff --git a/build/postinst_rpm b/build/postinst_rpm index f7570da5..8c9b7523 100644 --- a/build/postinst_rpm +++ b/build/postinst_rpm @@ -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 @@ -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 diff --git a/build/postrm b/build/postrm index f8e70154..8958f6c4 100644 --- a/build/postrm +++ b/build/postrm @@ -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 @@ -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 diff --git a/build/postrm_rpm b/build/postrm_rpm index 4da1a8b5..f8e74d76 100644 --- a/build/postrm_rpm +++ b/build/postrm_rpm @@ -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 diff --git a/build/prerm b/build/prerm index 6c483b14..87d26834 100644 --- a/build/prerm +++ b/build/prerm @@ -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 @@ -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 \ No newline at end of file diff --git a/build/prerm_rpm b/build/prerm_rpm index 58cb2e70..200dfb18 100644 --- a/build/prerm_rpm +++ b/build/prerm_rpm @@ -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 || :