fixup! Add tix-upgrade(8).
This commit is contained in:
parent
fa8dcef53a
commit
d992f098c2
|
@ -35,14 +35,12 @@ output_release_file= # TODO: A better term for this?
|
||||||
output_release_sig_file= # TODO: A better term for this?
|
output_release_sig_file= # TODO: A better term for this?
|
||||||
output_sha256sum=
|
output_sha256sum=
|
||||||
patch=false
|
patch=false
|
||||||
port=false
|
package=false
|
||||||
porttix=false
|
|
||||||
release=false
|
release=false
|
||||||
sha256=false
|
sha256=false
|
||||||
sha256sum=false
|
sha256sum=false
|
||||||
source=false
|
source=false
|
||||||
source_full=false
|
source_full=false
|
||||||
srctix=false
|
|
||||||
sysroot=""
|
sysroot=""
|
||||||
toolchain=false
|
toolchain=false
|
||||||
url=false
|
url=false
|
||||||
|
@ -115,15 +113,12 @@ for argument do
|
||||||
--output-sha256sum) previous_option=output_sha256sum ;;
|
--output-sha256sum) previous_option=output_sha256sum ;;
|
||||||
--output-upgrade-file=*) output_upgrade_file=$parameter ;;
|
--output-upgrade-file=*) output_upgrade_file=$parameter ;;
|
||||||
--output-upgrade-file) previous_option=output_upgrade_file ;;
|
--output-upgrade-file) previous_option=output_upgrade_file ;;
|
||||||
|
--package) package=true ;;
|
||||||
--patch) patch=true ;;
|
--patch) patch=true ;;
|
||||||
--port) port=true ;;
|
|
||||||
--porttix) porttix=true ;;
|
|
||||||
--release) release=true ;;
|
|
||||||
--sha256) sha256=true ;;
|
--sha256) sha256=true ;;
|
||||||
--sha256sum) sha256sum=true ;;
|
--sha256sum) sha256sum=true ;;
|
||||||
--source-full) source_full=true ;;
|
--source-full) source_full=true ;;
|
||||||
--source) source=true ;;
|
--source) source=true ;;
|
||||||
--srctix) srctix=true ;;
|
|
||||||
--sysroot) previous_option=sysroot ;;
|
--sysroot) previous_option=sysroot ;;
|
||||||
--sysroot=*) sysroot=$parameter ;;
|
--sysroot=*) sysroot=$parameter ;;
|
||||||
--toolchain) toolchain=true ;;
|
--toolchain) toolchain=true ;;
|
||||||
|
@ -158,7 +153,7 @@ conf() {
|
||||||
tix-vars -d "$2" - "$4"
|
tix-vars -d "$2" - "$4"
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdir=$(mktemp -dt tix-fetch-port.XXXXXX)
|
tmpdir=$(mktemp -dt tix-fetch.XXXXXX)
|
||||||
trap 'rm -rf -- "$tmpdir"' EXIT HUP INT QUIT TERM
|
trap 'rm -rf -- "$tmpdir"' EXIT HUP INT QUIT TERM
|
||||||
|
|
||||||
upgrade_conf="${collection%/}/etc/upgrade.conf"
|
upgrade_conf="${collection%/}/etc/upgrade.conf"
|
||||||
|
@ -428,8 +423,7 @@ fi
|
||||||
|
|
||||||
# Fetch each of the specified signed files from the mirror.
|
# Fetch each of the specified signed files from the mirror.
|
||||||
for REQUEST; do
|
for REQUEST; do
|
||||||
# If --port then fetch the port by the requested name.
|
if $package; then
|
||||||
if $port; then
|
|
||||||
REQUEST="$REQUEST.tix.tar.xz"
|
REQUEST="$REQUEST.tix.tar.xz"
|
||||||
REQUESTDIR="repository/$MACHINE-sortix/"
|
REQUESTDIR="repository/$MACHINE-sortix/"
|
||||||
elif $boot; then
|
elif $boot; then
|
||||||
|
@ -444,12 +438,6 @@ for REQUEST; do
|
||||||
elif $normalize; then
|
elif $normalize; then
|
||||||
REQUEST="$REQUEST.normalize"
|
REQUEST="$REQUEST.normalize"
|
||||||
REQUESTDIR="patches/"
|
REQUESTDIR="patches/"
|
||||||
elif $srctix; then
|
|
||||||
REQUEST="$REQUEST.srctix.tar.xz"
|
|
||||||
REQUESTDIR="srctix/"
|
|
||||||
elif $porttix; then
|
|
||||||
REQUEST="$REQUEST.porttix.tar.xz"
|
|
||||||
REQUESTDIR="porttix/"
|
|
||||||
elif $toolchain; then
|
elif $toolchain; then
|
||||||
REQUESTDIR="toolchain/"
|
REQUESTDIR="toolchain/"
|
||||||
else
|
else
|
||||||
|
|
110
tix/tix-upgrade
110
tix/tix-upgrade
|
@ -24,7 +24,6 @@ clean=false
|
||||||
collection=/
|
collection=/
|
||||||
download_only=false
|
download_only=false
|
||||||
fetch_options=
|
fetch_options=
|
||||||
ports_only=false
|
|
||||||
sysroot=""
|
sysroot=""
|
||||||
upgrade=--upgrade
|
upgrade=--upgrade
|
||||||
upgrade_ports=false
|
upgrade_ports=false
|
||||||
|
@ -107,6 +106,12 @@ if [ ! -e "$collection/tix/manifest/system" ]; then
|
||||||
upgrade_system=false
|
upgrade_system=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$upgrade_system$upgrade_ports" in
|
||||||
|
truefalse) what_to_upgrade=--system;;
|
||||||
|
falsetrue) what_to_upgrade=--ports;;
|
||||||
|
*) what_to_upgrade=;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "$cachedir" ]; then
|
if [ -z "$cachedir" ]; then
|
||||||
cachedir="${collection%/}/var/cache/tix"
|
cachedir="${collection%/}/var/cache/tix"
|
||||||
fi
|
fi
|
||||||
|
@ -120,7 +125,6 @@ if $cancel; then
|
||||||
sysmerge -t "$collection" --cancel
|
sysmerge -t "$collection" --cancel
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p -- "$cachedir"
|
mkdir -p -- "$cachedir"
|
||||||
mkdir -p -- "$cachedir/new"
|
mkdir -p -- "$cachedir/new"
|
||||||
|
|
||||||
|
@ -164,50 +168,42 @@ if [ -n "$UPGRADE_SIG_URL" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p -- "$cachedir/boot"
|
# Decide what binary packages to upgrade.
|
||||||
|
installed_packages=$(LC_ALL=C ls -- "$collection/tix/tixinfo")
|
||||||
|
if $upgrade_system && $upgrade_ports; then
|
||||||
|
upgrade_packages="$installed_packages"
|
||||||
|
else
|
||||||
|
upgrade_packages=
|
||||||
|
for package in $installed_packages; do
|
||||||
|
is_system=$(tix-vars -d false "$collection/tix/tixinfo/$package" SYSTEM)
|
||||||
|
if ($upgrade_system && [ "$is_system" = true ]) ||
|
||||||
|
($upgrade_ports && [ "$is_system" = false ]); then
|
||||||
|
upgrade_packages="$upgrade_packages $package"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fetch each binary package from the mirror.
|
||||||
|
# TODO: Handle new mandatory / recommended ports.
|
||||||
|
# TODO: Handle renamed ports.
|
||||||
mkdir -p -- "$cachedir/repository"
|
mkdir -p -- "$cachedir/repository"
|
||||||
|
packages=""
|
||||||
# TODO: DO NOT SUBMIT: Temporary -d system compatibility until builds roll.
|
for package in $(LC_ALL=C ls -- "$collection/tix/tixinfo"); do
|
||||||
SYSTEM_INITRDS=$(tix-vars -d system "$cachedir/release.sh" SYSTEM_INITRDS)
|
# The package exists upstream if it has a hash.
|
||||||
|
sha256=$(tix-fetch $fetch_options \
|
||||||
# TODO: What about the system source code in /src?
|
--collection="$collection" \
|
||||||
|
--input-release-file="$cachedir/release.sh" \
|
||||||
if $upgrade_system; then
|
--input-sha256sum="$cachedir/sha256sum" \
|
||||||
# Fetch the base system initrds from the mirror.
|
--sha256 --package -- $package)
|
||||||
for initrd in $SYSTEM_INITRDS; do
|
if [ -n "$sha256" ]; then
|
||||||
tix-fetch $fetch_options \
|
tix-fetch $fetch_options \
|
||||||
--collection="$collection" \
|
--collection="$collection" \
|
||||||
--input-release-file="$cachedir/release.sh" \
|
--input-release-file="$cachedir/release.sh" \
|
||||||
--input-sha256sum="$cachedir/sha256sum" \
|
--input-sha256sum="$cachedir/sha256sum" \
|
||||||
-c --initrd -O "$cachedir/boot" -- "$initrd"
|
-c --package -O "$cachedir/repository" -- $package
|
||||||
done
|
packages="$packages $package"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
if $upgrade_ports; then
|
|
||||||
# Fetch each port from the mirror.
|
|
||||||
# TODO: Handle new mandatory / recommended ports.
|
|
||||||
# TODO: Handle renamed ports.
|
|
||||||
mkdir -p "$cachedir/repository"
|
|
||||||
ports=""
|
|
||||||
for port in $(LC_ALL=C ls -- "$collection/tix/tixinfo"); do
|
|
||||||
# The port has a hash if if it exists upstream.
|
|
||||||
sha256=$(tix-fetch $fetch_options \
|
|
||||||
--collection="$collection" \
|
|
||||||
--input-release-file="$cachedir/release.sh" \
|
|
||||||
--input-sha256sum="$cachedir/sha256sum" \
|
|
||||||
--sha256 --port -- $port)
|
|
||||||
# If the port exists upstream, get the latest version and note its name down
|
|
||||||
# for the extraction step.
|
|
||||||
if [ -n "$sha256" ]; then
|
|
||||||
tix-fetch $fetch_options \
|
|
||||||
--collection="$collection" \
|
|
||||||
--input-release-file="$cachedir/release.sh" \
|
|
||||||
--input-sha256sum="$cachedir/sha256sum" \
|
|
||||||
-c --port -O "$cachedir/repository" -- $port
|
|
||||||
ports="$ports $port"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Stop if only downloading.
|
# Stop if only downloading.
|
||||||
if $download_only; then
|
if $download_only; then
|
||||||
|
@ -229,35 +225,15 @@ release_sig_url = $UPGRADE_SIG_URL
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the base system into the sysroot.
|
# Extract the binary packages into the sysroot.
|
||||||
if $upgrade_system; then
|
for package in $packages; do
|
||||||
for initrd in $SYSTEM_INITRDS; do
|
echo "Extracting $package.tix.tar.xz..."
|
||||||
echo "Extracting $initrd.tar.xz..."
|
tar -C "$cachedir/sysroot" -xJf "$cachedir/repository/$package.tix.tar.xz"
|
||||||
tar -C "$cachedir/sysroot" -xJf "$cachedir/boot/$initrd.tar.xz"
|
rm -f "$cachedir/repository/$package.tix.tar.xz"
|
||||||
rm -f "$cachedir/boot/$initrd.tar.xz"
|
done
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the ports into the sysroot.
|
|
||||||
full=
|
|
||||||
if $upgrade_ports; then
|
|
||||||
full=--full
|
|
||||||
for port in $ports; do
|
|
||||||
echo "Extracting $port.tix.tar.xz..."
|
|
||||||
tar -C "$cachedir/sysroot" -xJf "$cachedir/repository/$port.tix.tar.xz"
|
|
||||||
rm -f "$cachedir/repository/$port.tix.tar.xz"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$upgrade_system$upgrade_ports" in
|
|
||||||
truefalse) what_to_upgrade=--system;;
|
|
||||||
falsetrue) what_to_upgrade=--ports;;
|
|
||||||
*) what_to_upgrade=;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Merge the new sysroot onto the installation.
|
# Merge the new sysroot onto the installation.
|
||||||
sysmerge -t "$collection" $what_to_upgrade $full $wait "$cachedir/sysroot"
|
sysmerge -t "$collection" $what_to_upgrade $full $wait "$cachedir/sysroot"
|
||||||
|
|
||||||
rm -rf -- "$cachedir/boot"
|
|
||||||
rm -rf -- "$cachedir/repository"
|
rm -rf -- "$cachedir/repository"
|
||||||
rm -rf -- "$cachedir/sysroot"
|
rm -rf -- "$cachedir/sysroot"
|
||||||
|
|
Loading…
Reference in New Issue