Browse Source

OS-8400 pkgsrc-setup should be able to re-bootstrap (#1053)

Reviewed by: Dan McDonald <danmcd@kebe.com>
Reviewed by: Travis <Tr@visPaul.me>
Approved by: Dan McDonald <danmcd@kebe.com>
pull/1054/head
Brian Bennett 2 months ago committed by GitHub
parent
commit
1dc43d6ef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      man/manifest
  2. 25
      man/smartdc/man/man1/pkgsrc-setup.1.md
  3. 22
      src/smartdc/bin/pkgsrc-setup.sh

1
man/manifest

@ -4,6 +4,7 @@ d usr/share/man/man1 0755 root bin
d usr/share/man/man3lib 0755 root bin
d usr/share/man/man7 0755 root bin
d usr/share/man/man8 0755 root bin
f smartdc/man/man1/pkgsrc-setup.1 0444 root bin
f smartdc/man/man1/sdc-factoryreset.1 0444 root bin
f smartdc/man/man1/sdc-lastcomm.1 0444 root bin
f smartdc/man/man1/sdc-zfs-io-throttle.1 0444 root bin

25
man/smartdc/man/man1/pkgsrc-setup.1.md

@ -0,0 +1,25 @@
# pkgsrc-setup(1) -- bootstrap pkgsrc-tools
## SYNOPSIS
`pkgsrc-setup [--clean]`
## DESCRIPTION
This command installs pkgsrc-tools for the global zone to /opt/tools.
## OPTIONS
`--clean`
This option will re-bootstrap the pkgsrc-tools installation by removing
/opt/tools and reinstalling all currently installed packages.
Re-bootstrapping is generally not necessary, but can be used to "reset"
the installation without having to manually reinstall all packages.
## COPYRIGHT
pkgsrc-setup Copyright 2022 MNX Cloud, Inc.

22
src/smartdc/bin/pkgsrc-setup.sh

@ -18,6 +18,21 @@ if [[ -n "$TRACE" ]]; then
set -o xtrace
fi
# If there's an existing install...
if [[ -e /opt/tools/bin/pkgin ]]; then
# Re-bootstrap pkgsrc if requested.
if [[ $1 == '--clean' ]]; then
pkg_stash=$(mktemp)
pkgin export > "$pkg_stash"
rm -rf /opt/tools
shift
else
# Don't stomp an existing install.
printf 'pkgsrc has already been set up.\n'
exit
fi
fi
root="/${1}"
# Occasionally, the filename and hash will need to be updated. Refer to
@ -41,7 +56,12 @@ if [[ -d "$root" ]]; then
tar -zxpf ${BOOTSTRAP_TAR} -C "${root}"
fi
if [[ -n $pkg_stash ]]; then
pkgin -y import "$pkg_stash"
rm "${pkg_stash:?}"
fi
if [[ ${#root} == 1 ]]; then
printf 'The pkgsrc-tools collection is now ready for use. It will be in\n'
printf '\nThe pkgsrc-tools collection is now ready for use. It will be in\n'
printf 'your PATH the next time you log in.\n'
fi

Loading…
Cancel
Save