pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Import sysutils/sysupgrade



Module Name:	pkgsrc-wip
Committed By:	kikadf <kikadf.01%gmail.com@localhost>
Pushed By:	kikadf
Date:		Tue Oct 22 15:09:18 2024 +0200
Changeset:	62126deaa2fde6278a18b6af57417ee7ac1fd5e8

Added Files:
	sysupgrade/DESCR
	sysupgrade/Makefile
	sysupgrade/PLIST
	sysupgrade/distinfo
	sysupgrade/patches/patch-default.conf
	sysupgrade/patches/patch-sysupgrade.conf.5.in
	sysupgrade/patches/patch-sysupgrade.sh

Log Message:
Import sysutils/sysupgrade

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=62126deaa2fde6278a18b6af57417ee7ac1fd5e8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 sysupgrade/DESCR                              |  15 +++
 sysupgrade/Makefile                           |  43 +++++++
 sysupgrade/PLIST                              |  11 ++
 sysupgrade/distinfo                           |   8 ++
 sysupgrade/patches/patch-default.conf         |  31 +++++
 sysupgrade/patches/patch-sysupgrade.conf.5.in |  21 ++++
 sysupgrade/patches/patch-sysupgrade.sh        | 168 ++++++++++++++++++++++++++
 7 files changed, 297 insertions(+)

diffs:
diff --git a/sysupgrade/DESCR b/sysupgrade/DESCR
new file mode 100644
index 0000000000..74eac4397a
--- /dev/null
+++ b/sysupgrade/DESCR
@@ -0,0 +1,15 @@
+sysupgrade is a script to automate NetBSD system upgrades.  sysupgrade
+works by first fetching distribution sets from a specified site or local
+directory, then by upgrading the system using such distribution sets and
+later by ensuring that the system configuration is up to date.  All the
+process is controlled by a configuration file, and the defaults should
+suit the most common NetBSD upgrades.
+
+sysupgrade can be used to perform upgrades across different system major
+and/or minor versions, and it can also be used to track a stable or
+development branch from the CVS repository.
+
+sysbuild is the perfect companion to sysupgrade in those cases where you
+want to roll your own binaries: both utilities share a very similar
+command-line and configuration interface, and the default configuration
+files provide examples on how to integrate one with the other.
diff --git a/sysupgrade/Makefile b/sysupgrade/Makefile
new file mode 100644
index 0000000000..d3ef54b479
--- /dev/null
+++ b/sysupgrade/Makefile
@@ -0,0 +1,43 @@
+# $NetBSD: Makefile,v 1.21 2024/07/25 05:41:52 wiz Exp $
+
+DISTNAME=	sysupgrade-1.5
+PKGREVISION=	10
+CATEGORIES=	sysutils
+MASTER_SITES=	${MASTER_SITE_GITHUB:=jmmv/}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+COMMENT=	Automate upgrades of NetBSD
+LICENSE=	modified-bsd
+
+GNU_CONFIGURE=		yes
+TEST_TARGET=		check
+USE_LANGUAGES=		# empty
+USE_TOOLS=		pkg-config
+
+BUILD_DEFS+=		VARBASE
+SYSUPGRADE_CACHEDIR=	${VARBASE}/cache/sysupgrade
+OWN_DIRS_PERMS=		${SYSUPGRADE_CACHEDIR} \
+			${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0755
+CONFIGURE_ARGS+=	SYSUPGRADE_CACHEDIR=${SYSUPGRADE_CACHEDIR}
+
+CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
+INSTALL_MAKE_FLAGS+=	sysconfdir=${EGDIR}
+EGDIR=			${PREFIX}/share/examples/sysupgrade
+CONF_FILES+=		${EGDIR}/default.conf ${PKG_SYSCONFDIR}/sysupgrade.conf
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.sysupgrade
+PKG_SUPPORTED_OPTIONS=	tests
+PKG_SUGGESTED_OPTIONS=	tests
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mtests)
+.  include "../../devel/atf/buildlink3.mk"
+PLIST_SUBST+=	TESTS=
+.else
+PLIST_SUBST+=	TESTS=@comment
+.endif
+
+BUILDLINK_API_DEPENDS.shtk+=	shtk>=1.3
+.include "../../devel/shtk/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysupgrade/PLIST b/sysupgrade/PLIST
new file mode 100644
index 0000000000..d7c37698ec
--- /dev/null
+++ b/sysupgrade/PLIST
@@ -0,0 +1,11 @@
+@comment $NetBSD: PLIST,v 1.3 2013/07/28 23:37:14 jmmv Exp $
+man/man5/sysupgrade.conf.5
+man/man8/sysupgrade.8
+sbin/sysupgrade
+share/doc/sysupgrade/AUTHORS
+share/doc/sysupgrade/COPYING
+share/doc/sysupgrade/NEWS
+share/doc/sysupgrade/README
+share/examples/sysupgrade/default.conf
+${TESTS}tests/sysupgrade/Kyuafile
+${TESTS}tests/sysupgrade/sysupgrade_test
diff --git a/sysupgrade/distinfo b/sysupgrade/distinfo
new file mode 100644
index 0000000000..0c519adcd0
--- /dev/null
+++ b/sysupgrade/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.13 2022/04/15 09:10:56 nia Exp $
+
+BLAKE2s (sysupgrade-1.5.tar.gz) = 5fb73e83c7b9b1a891ce0cfb26422f07822061e2df42db6a4e3692468d028186
+SHA512 (sysupgrade-1.5.tar.gz) = 47f37ce6802b8ba74d6edd19a2c80d46394c992b58d3077e6d1316e4f5505afbe53a68d28b28779a10a78d7be05f2f5b9d2a55b5b2f845bcc59a78950a8306f8
+Size (sysupgrade-1.5.tar.gz) = 75833 bytes
+SHA1 (patch-default.conf) = 2457714998c86994192ef57c5dd22646f76828c4
+SHA1 (patch-sysupgrade.conf.5.in) = 2e1c0602fd58edb13abac98bf5db0b1e17360d20
+SHA1 (patch-sysupgrade.sh) = a20926d0012a0797aa6f8363661d1a94d14de126
diff --git a/sysupgrade/patches/patch-default.conf b/sysupgrade/patches/patch-default.conf
new file mode 100644
index 0000000000..83f6e6c541
--- /dev/null
+++ b/sysupgrade/patches/patch-default.conf
@@ -0,0 +1,31 @@
+$NetBSD: patch-default.conf,v 1.3 2021/03/14 08:44:01 nia Exp $
+
+* Use more useful example URLs
+* Add variable for archive file extension
+
+--- default.conf.orig	2013-07-28 21:04:02.000000000 +0000
++++ default.conf
+@@ -7,9 +7,13 @@
+ # configuration variables are listed in this sample configuration file.
+ 
+ # Path to the release files (local path or remote URL).
+-#RELEASEDIR="ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/$(uname -m)"
+ #RELEASEDIR="ssh://me%builder.example.net@localhost/home/sysbuild/release/$(uname -m)"
+-RELEASEDIR="/home/sysbuild/release/$(uname -m)"
++#RELEASEDIR="/home/sysbuild/release/$(uname -m)"
++#RELEASEDIR="https://cdn.NetBSD.org/pub/NetBSD/NetBSD-9.1/$(uname -m)"
++# Upgrade to the latest snapshot of the current branch
++#RELEASEDIR="https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/$(uname -m)"
++# Upgrade to the latest snapshot of a stable branch
++RELEASEDIR="https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/$(uname -m)"
+ 
+ # Name of the kernel to be installed.
+ KERNEL=AUTO  # Guess from /netbsd (requires config(1)).
+@@ -34,3 +38,7 @@ POSTINSTALL_AUTOFIX="obsolete"
+ # do "sysupgrade etcupdate" using the same etc.tgz file downloaded during
+ # the upgrade, you will need the same etc.tgz file to be present.
+ #AUTOCLEAN=no
++
++# Archive file extension of the sets. For now it can be either 'tgz' or
++# 'tar.xz'.
++#ARCHIVE_EXTENSION=tar.xz
diff --git a/sysupgrade/patches/patch-sysupgrade.conf.5.in b/sysupgrade/patches/patch-sysupgrade.conf.5.in
new file mode 100644
index 0000000000..7b921d0616
--- /dev/null
+++ b/sysupgrade/patches/patch-sysupgrade.conf.5.in
@@ -0,0 +1,21 @@
+$NetBSD: patch-sysupgrade.conf.5.in,v 1.2 2022/04/15 09:10:56 nia Exp $
+
+* Add variable for archive file extension
+
+--- sysupgrade.conf.5.in.orig	2013-07-28 21:26:59.000000000 +0000
++++ sysupgrade.conf.5.in
+@@ -162,6 +162,14 @@ The presence of a modules set enables th
+ procedure.
+ .Pp
+ Default: AUTO.
++.It Va ARCHIVE_EXTENSION
++.Pp
++Archive file extension of the sets. Can be either
++.Sq tgz
++or
++.Sq tar.xz .
++.Pp
++Default: depends on CPU architecture.
+ .El
+ .Sh SEE ALSO
+ .Xr sysupgrade 8
diff --git a/sysupgrade/patches/patch-sysupgrade.sh b/sysupgrade/patches/patch-sysupgrade.sh
new file mode 100644
index 0000000000..4d16145f4e
--- /dev/null
+++ b/sysupgrade/patches/patch-sysupgrade.sh
@@ -0,0 +1,168 @@
+$NetBSD: patch-sysupgrade.sh,v 1.8 2022/04/15 09:10:56 nia Exp $
+
+* Don't reject https in sysupgrade_fetch()
+* Add ARCHIVE_EXTENSION variable (Fix PR pkg/53697)
+* Use direct paths to etcupdate and postinstall
+  (protect against user misconfiguration).
+
+--- sysupgrade.sh.orig	2013-07-28 21:27:57.000000000 +0000
++++ sysupgrade.sh
+@@ -39,7 +39,8 @@ shtk_import process
+ #
+ # Please remember to update sysbuild(1) if you change this list.
+ SYSUPGRADE_CONFIG_VARS="AUTOCLEAN CACHEDIR DESTDIR ETCUPDATE KERNEL
+-                        POSTINSTALL_AUTOFIX RELEASEDIR SETS"
++                        POSTINSTALL_AUTOFIX RELEASEDIR SETS
++                        ARCHIVE_EXTENSION"
+ 
+ 
+ # Directory in which to keep downloaded release files.
+@@ -66,6 +67,11 @@ sysupgrade_set_defaults() {
+     shtk_config_set ETCUPDATE "yes"
+     shtk_config_set KERNEL "AUTO"
+     shtk_config_set SETS "AUTO"
++    if [ "$(uname -p)" = 'x86_64' ] || [ "$(uname -p)" = 'sparc64' ]; then
++        shtk_config_set ARCHIVE_EXTENSION "tar.xz"
++    else
++        shtk_config_set ARCHIVE_EXTENSION "tgz"
++    fi
+ }
+ 
+ 
+@@ -163,18 +169,29 @@ require_cached_file() {
+ # The set to be extracted must have been previously fetched into the cache
+ # directory by sysupgrade_fetch command.
+ #
+-# \param set_name Name of the set to extract, without the .tgz extension.
++# \param set_name Name of the set to extract, without the archive extension.
+ extract_set() {
+     local set_name="${1}"; shift
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
+ 
+-    require_cached_file "${set_name}.tgz"
++    require_cached_file "${set_name}.${arch_ext}"
+ 
+     local destdir="$(shtk_config_get_default DESTDIR "")"
+-    local set_tgz="$(get_cached_file "${set_name}.tgz")"
++    local set_arch="$(get_cached_file "${set_name}.${arch_ext}")"
+ 
+     shtk_cli_info "Extracting ${set_name} into ${destdir}/"
+     [ -z "${destdir}" ] || shtk_process_run mkdir -p "${destdir}"
+-    progress -zf "${set_tgz}" tar -xp -C "${destdir}/" -f -
++    case "${arch_ext}" in
++        tgz)
++            progress -zf "${set_arch}" tar -xp -C "${destdir}/" -f -
++            ;;
++        tar.xz)
++            progress -f "${set_arch}" tar -xJp -C "${destdir}/" -f -
++            ;;
++        *)
++            shtk_cli_error "Unsupported archive extension ${arch_ext}"
++            ;;
++        esac
+ }
+ 
+ 
+@@ -189,9 +206,10 @@ sysupgrade_fetch() {
+ 
+     local releasedir="$(shtk_config_get RELEASEDIR)"
+     local cachedir="$(shtk_config_get CACHEDIR)"
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
+     local fetch_files=
+     for set_name in $(shtk_config_get SETS); do
+-        fetch_files="${fetch_files} binary/sets/${set_name}.tgz"
++        fetch_files="${fetch_files} binary/sets/${set_name}.${arch_ext}"
+     done
+     if shtk_config_has KERNEL; then
+         local kernel_name="$(shtk_config_get KERNEL)"
+@@ -199,7 +217,7 @@ sysupgrade_fetch() {
+     fi
+ 
+     case "${releasedir}" in
+-        ftp://*|http://*)
++        ftp://*|http://*|https://*)
+             mkdir -p "${cachedir}"
+ 
+             for relative_file in ${fetch_files}; do
+@@ -320,6 +338,7 @@ sysupgrade_modules() {
+ #
+ # \param ... Names of the sets to extract, to override SETS.
+ sysupgrade_sets() {
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
+     local sets=
+     for set_name in "${@:-$(shtk_config_get SETS)}"; do
+         case "${set_name}" in
+@@ -334,7 +353,7 @@ sysupgrade_sets() {
+     done
+ 
+     for set_name in ${sets}; do
+-        require_cached_file "${set_name}.tgz"
++        require_cached_file "${set_name}.${arch_ext}"
+     done
+ 
+     shtk_cli_info "Upgrading base system"
+@@ -346,6 +365,7 @@ sysupgrade_sets() {
+ 
+ # Runs etcupdate to install new configuration files.
+ sysupgrade_etcupdate() {
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
+     [ ${#} -eq 0 ] || shtk_cli_usage_error "etcupdate does not take any" \
+         "arguments"
+ 
+@@ -366,12 +386,12 @@ sysupgrade_etcupdate() {
+ 
+     local sflags=
+     for set_name in ${sets}; do
+-        require_cached_file "${set_name}.tgz"
+-        sflags="${sflags} -s$(get_cached_file "${set_name}.tgz")"
++        require_cached_file "${set_name}.${arch_ext}"
++        sflags="${sflags} -s$(get_cached_file "${set_name}.${arch_ext}")"
+     done
+ 
+     shtk_cli_info "Upgrading /etc interactively"
+-    etcupdate -a -l ${sflags}
++    /usr/sbin/etcupdate -a -l ${sflags}
+ }
+ 
+ 
+@@ -381,6 +401,7 @@ sysupgrade_etcupdate() {
+ sysupgrade_postinstall() {
+     local sets=
+     local sets="$(shtk_list_filter '*etc' $(shtk_config_get SETS))"
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
+     if [ -z "${sets}" ]; then
+         shtk_cli_info "Skipping postinstall (no etc sets in SETS)"
+         return 0
+@@ -392,8 +413,8 @@ sysupgrade_postinstall() {
+ 
+     local sflags=
+     for set_name in ${sets}; do
+-        require_cached_file "${set_name}.tgz"
+-        sflags="${sflags} -s$(get_cached_file "${set_name}.tgz")"
++        require_cached_file "${set_name}.${arch_ext}"
++        sflags="${sflags} -s$(get_cached_file "${set_name}.${arch_ext}")"
+     done
+ 
+     shtk_cli_info "Performing postinstall checks"
+@@ -402,17 +423,20 @@ sysupgrade_postinstall() {
+         postinstall "-d${destdir}/" ${sflags} fix \
+             $(shtk_config_get POSTINSTALL_AUTOFIX)
+     fi
+-    postinstall "-d${destdir}/" ${sflags} "${@:-check}" \
++    /usr/sbin/postinstall "-d${destdir}/" ${sflags} "${@:-check}" \
+         || shtk_cli_error "Some postinstall(8) checks have failed"
+ }
+ 
+ 
+ # Cleans up the cache directory.
+ sysupgrade_clean() {
++    local arch_ext="$(shtk_config_get ARCHIVE_EXTENSION)"
++
+     [ ${#} -eq 0 ] || shtk_cli_usage_error "clean does not take any arguments"
+ 
+     shtk_cli_info "Cleaning downloaded files"
+     rm -f "$(shtk_config_get CACHEDIR)"/*.*gz*
++    rm -f "$(shtk_config_get CACHEDIR)"/*.${arch_ext}*
+ }
+ 
+ 


Home | Main Index | Thread Index | Old Index