fixup! Add tix-upgrade(8).
This commit is contained in:
parent
401ec64e3a
commit
7f8cb8aecc
|
@ -19,8 +19,9 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cachedir=""
|
cachedir=""
|
||||||
|
cancel=false
|
||||||
clean=false
|
clean=false
|
||||||
collection=""
|
collection=/
|
||||||
download_only=false
|
download_only=false
|
||||||
fetch_options=
|
fetch_options=
|
||||||
ports_only=false
|
ports_only=false
|
||||||
|
@ -50,6 +51,7 @@ for argument do
|
||||||
-w) wait=-w ;;
|
-w) wait=-w ;;
|
||||||
--cachedir=*) cachedir=$parameter ;;
|
--cachedir=*) cachedir=$parameter ;;
|
||||||
--cachedir) previous_option=cachedir ;;
|
--cachedir) previous_option=cachedir ;;
|
||||||
|
--cancel) cancel=true ;;
|
||||||
--clean) clean=true ;;
|
--clean) clean=true ;;
|
||||||
--collection=*) collection=$parameter ;;
|
--collection=*) collection=$parameter ;;
|
||||||
--collection) previous_option=collection ;;
|
--collection) previous_option=collection ;;
|
||||||
|
@ -74,36 +76,47 @@ if test -n "$previous_option"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Reject additional operands.
|
if [ 0 -lt $# ]; then
|
||||||
|
echo "$0: Unexpected extra operand: $1" >&2
|
||||||
if [ -z "$collection" ]; then
|
exit 1
|
||||||
collection="$sysroot"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$collection" ]; then
|
get_conf() {
|
||||||
collection=$(cd "$collection" && pwd)
|
sed -E -e 's/([a-zA-Z0-9_]+) *? *= */\U\1=/' \
|
||||||
fi
|
-e 's/=yes$/=true/' -e 's/no$/=false/' "$3" | \
|
||||||
|
tix-vars -d "$2" - "$4"
|
||||||
|
}
|
||||||
|
|
||||||
|
collection=$(cd "$collection" && pwd)
|
||||||
|
|
||||||
if ! $upgrade_ports && ! $upgrade_system; then
|
if ! $upgrade_ports && ! $upgrade_system; then
|
||||||
# TODO: Ability to set default in /etc/upgrade.conf.
|
|
||||||
upgrade_ports=true
|
upgrade_ports=true
|
||||||
upgrade_system=true
|
upgrade_system=true
|
||||||
|
if [ -e "$collection/etc/upgrade.conf" ]; then
|
||||||
|
upgrade_ports=$(get_conf -d true "$collection/etc/upgrade.conf" PORTS)
|
||||||
|
upgrade_system=$(get_conf -d true "$collection/etc/upgrade.conf" SYSTEM)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update only ports if this isn't a whole system installation.
|
# If this isn't a system installation, only upgrade the ports.
|
||||||
if [ ! -e "$collection/tix/manifest/system" ]; then
|
if [ ! -e "$collection/tix/manifest/system" ]; then
|
||||||
upgrade_system=false
|
upgrade_system=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$cachedir" ]; then
|
if [ -z "$cachedir" ]; then
|
||||||
cachedir="$collection/var/cache/tix"
|
cachedir="${collection%/}/var/cache/tix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $clean; then
|
if $cancel || $clean; then
|
||||||
echo "Removing cache directory: $cachedir"
|
echo "Removing cache directory: $cachedir"
|
||||||
rm -rf -- "$cachedir"
|
rm -rf -- "$cachedir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $cancel; then
|
||||||
|
sysmerge -t "$collection" --cancel
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p -- "$cachedir"
|
mkdir -p -- "$cachedir"
|
||||||
mkdir -p -- "$cachedir/new"
|
mkdir -p -- "$cachedir/new"
|
||||||
|
|
||||||
|
@ -115,11 +128,10 @@ tix-fetch $fetch_options \
|
||||||
|
|
||||||
# If release.sig.sh or sha256sum changed, clean the cache directory of downloads
|
# If release.sig.sh or sha256sum changed, clean the cache directory of downloads
|
||||||
# that were currently in progress as they might not have the right checksums.
|
# that were currently in progress as they might not have the right checksums.
|
||||||
# TODO: This requires diff(1) in the base system! Avoid that. Get a cmp(1)!
|
if [ ! -e "$cachedir/release.sh.sig" ] ||
|
||||||
if ! diff -- "$cachedir/release.sh.sig" \
|
[ ! -e "$cachedir/sha256sum" ] ||
|
||||||
"$cachedir/new/release.sh.sig" 1>/dev/null 2>/dev/null ||
|
! (cd "$cachedir/new" && sha256sum release.sh.sig sha256sum) |
|
||||||
! diff -- "$cachedir/sha256sum" \
|
(cd "$cachedir" && sha256sum -cs); then
|
||||||
"$cachedir/new/sha256sum" 1>/dev/null 2>/dev/null; then
|
|
||||||
rm -rf -- "$cachedir/boot"
|
rm -rf -- "$cachedir/boot"
|
||||||
rm -rf -- "$cachedir/repository"
|
rm -rf -- "$cachedir/repository"
|
||||||
rm -rf -- "$cachedir/sysroot"
|
rm -rf -- "$cachedir/sysroot"
|
||||||
|
@ -139,7 +151,6 @@ mkdir -p "$cachedir/repository"
|
||||||
if $upgrade_system; then
|
if $upgrade_system; then
|
||||||
# Fetch the base system initrds from the mirror.
|
# Fetch the base system initrds from the mirror.
|
||||||
# TODO: What about the system source code in /src?
|
# TODO: What about the system source code in /src?
|
||||||
# TODO: Get the overlay initrd if it exists.
|
|
||||||
tix-fetch $fetch_options \
|
tix-fetch $fetch_options \
|
||||||
--collection="$collection" \
|
--collection="$collection" \
|
||||||
--input-release-sig-file="$cachedir/release.sh.sig" \
|
--input-release-sig-file="$cachedir/release.sh.sig" \
|
||||||
|
@ -152,7 +163,6 @@ if $upgrade_ports; then
|
||||||
ports=$(LC_ALL=C ls -- "$collection/tix/tixinfo")
|
ports=$(LC_ALL=C ls -- "$collection/tix/tixinfo")
|
||||||
# TODO: Handle new mandatory / recommended ports.
|
# TODO: Handle new mandatory / recommended ports.
|
||||||
# TODO: Handle renamed ports.
|
# TODO: Handle renamed ports.
|
||||||
# TODO: This fails if the port does not exist upstream.
|
|
||||||
mkdir -p "$cachedir/repository"
|
mkdir -p "$cachedir/repository"
|
||||||
for port in $ports; do
|
for port in $ports; do
|
||||||
# The port has a hash if if it exists upstream.
|
# The port has a hash if if it exists upstream.
|
||||||
|
|
Loading…
Reference in New Issue