Reinstall system from packages during sysa->sysc and sysb->sysc transitions.
This commit is contained in:
parent
594fd62e7e
commit
ef0030bbf3
|
@ -24,7 +24,7 @@ shell_lint_task:
|
||||||
- apt-get -y install shellcheck
|
- apt-get -y install shellcheck
|
||||||
- apt-get -y clean
|
- apt-get -y clean
|
||||||
check_script:
|
check_script:
|
||||||
- shellcheck sysa/run.sh sysb/run.sh sysc/run.sh sysc/run2.sh sysa/helpers.sh
|
- shellcheck sysa/run.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysc/run2.sh sysa/helpers.sh
|
||||||
|
|
||||||
reuse_lint_task:
|
reuse_lint_task:
|
||||||
container:
|
container:
|
||||||
|
|
|
@ -160,7 +160,7 @@ b418ef47a65ba1f52f0b79a96ce2ebf1bb1f4f2a78e3985fa512e6c41477f100 perl5.005-03_0
|
||||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.10.1_0.links
|
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.10.1_0.links
|
||||||
0e216f189404be18ef7463665e9288258058b322f0636e9b9c19b5262af7980a perl-5.10.1_0.tar.bz2
|
0e216f189404be18ef7463665e9288258058b322f0636e9b9c19b5262af7980a perl-5.10.1_0.tar.bz2
|
||||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.32.1_0.links
|
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.32.1_0.links
|
||||||
9ed0a0c9ff88af07ea2cb2eea6367365da42a346a81b537f6e4a3dc80076953d perl-5.32.1_0.tar.bz2
|
de89e006bed3db40681e3d3f7a485526299d3bebbf4a2ed825f62a7fa94b5947 perl-5.32.1_0.tar.bz2
|
||||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.6.2_0.links
|
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 perl-5.6.2_0.links
|
||||||
b5fce312b381d0135d44b1bd30089e89e17ce35e6cf5e326eac87baf6c554dd4 perl-5.6.2_0.tar.bz2
|
b5fce312b381d0135d44b1bd30089e89e17ce35e6cf5e326eac87baf6c554dd4 perl-5.6.2_0.tar.bz2
|
||||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 pkg-config-0.29.2_0.links
|
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 pkg-config-0.29.2_0.links
|
||||||
|
|
|
@ -310,30 +310,35 @@ src_apply() {
|
||||||
if command -v xbps-install >/dev/null 2>&1; then
|
if command -v xbps-install >/dev/null 2>&1; then
|
||||||
xbps-install -y -R /usr/src/repo "${pkg%%-[0-9]*}"
|
xbps-install -y -R /usr/src/repo "${pkg%%-[0-9]*}"
|
||||||
else
|
else
|
||||||
# Overwriting files is mega busted, so do it manually
|
src_apply_tar "${pkg}" "${revision}"
|
||||||
# shellcheck disable=SC2162
|
|
||||||
if [ -e /tmp/filelist.txt ]; then
|
|
||||||
while IFS= read -d $'\0' file; do
|
|
||||||
rm -f "/${file}" >/dev/null 2>&1 || true
|
|
||||||
done < /tmp/filelist.txt
|
|
||||||
fi
|
|
||||||
bzip2 -dc "/usr/src/repo/${pkg}_${revision}.tar.bz2" | \
|
|
||||||
tar -C / -xpf -
|
|
||||||
# shellcheck disable=SC2162
|
|
||||||
# ^ read -r unsupported in old bash
|
|
||||||
while read line; do
|
|
||||||
# shellcheck disable=SC2001
|
|
||||||
# ^ cannot use variable expansion here
|
|
||||||
fname="$(echo "${line}" | sed 's/.* //')"
|
|
||||||
rm -f "${fname}"
|
|
||||||
# shellcheck disable=SC2226,SC2086
|
|
||||||
# ^ ${line} expands into two arguments
|
|
||||||
ln -s ${line}
|
|
||||||
touch -t 197001010000.00 "${fname}"
|
|
||||||
done < "/usr/src/repo/${pkg}_${revision}.links"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src_apply_tar() {
|
||||||
|
local pkg=$1 revision=$2
|
||||||
|
# Overwriting files is mega busted, so do it manually
|
||||||
|
# shellcheck disable=SC2162
|
||||||
|
if [ -e /tmp/filelist.txt ]; then
|
||||||
|
while IFS= read -d $'\0' file; do
|
||||||
|
rm -f "/${file}" >/dev/null 2>&1 || true
|
||||||
|
done < /tmp/filelist.txt
|
||||||
|
fi
|
||||||
|
bzip2 -dc "/usr/src/repo/${pkg}_${revision}.tar.bz2" | \
|
||||||
|
tar -C / -xpf -
|
||||||
|
# shellcheck disable=SC2162
|
||||||
|
# ^ read -r unsupported in old bash
|
||||||
|
while read line; do
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
# ^ cannot use variable expansion here
|
||||||
|
fname="$(echo "${line}" | sed 's/.* //')"
|
||||||
|
rm -f "${fname}"
|
||||||
|
# shellcheck disable=SC2226,SC2086
|
||||||
|
# ^ ${line} expands into two arguments
|
||||||
|
ln -s ${line}
|
||||||
|
touch -t 197001010000.00 "${fname}"
|
||||||
|
done < "/usr/src/repo/${pkg}_${revision}.links"
|
||||||
|
}
|
||||||
|
|
||||||
# Check if bash function exists
|
# Check if bash function exists
|
||||||
fn_exists() {
|
fn_exists() {
|
||||||
test "$(type -t "$1")" == 'function'
|
test "$(type -t "$1")" == 'function'
|
||||||
|
@ -376,3 +381,22 @@ populate_device_nodes() {
|
||||||
test -c "${1}/dev/console" || mknod -m 666 "${1}/dev/console" c 5 1
|
test -c "${1}/dev/console" || mknod -m 666 "${1}/dev/console" c 5 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sys_transfer() {
|
||||||
|
local dest=$1
|
||||||
|
|
||||||
|
mkdir -p "${dest}/${PREFIX}/bin" "${dest}/${PREFIX}/src"
|
||||||
|
|
||||||
|
# Bash, Tar and Bzip2 are required to install packages
|
||||||
|
cp "${PREFIX}/bin/bash" "${PREFIX}/bin/tar" "${PREFIX}/bin/bzip2" "${dest}${PREFIX}/bin/"
|
||||||
|
|
||||||
|
# Transfer misc files
|
||||||
|
cp "${SOURCES}/helpers.sh" "${SOURCES}/SHA256SUMS.pkgs" "${SOURCES}/bootstrap.cfg" "${dest}/"
|
||||||
|
|
||||||
|
cp -r "${PREFIX}/src/" "${dest}${PREFIX}/"
|
||||||
|
|
||||||
|
shift
|
||||||
|
# Copy additional binaries
|
||||||
|
set -- "${@/#/${PREFIX}/bin/}"
|
||||||
|
cp "$@" "${dest}${PREFIX}/bin/"
|
||||||
|
}
|
||||||
|
|
|
@ -253,7 +253,6 @@ if [ "${CHROOT}" = False ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# In chroot mode transition directly into System C.
|
# In chroot mode transition directly into System C.
|
||||||
SYSC="/sysc"
|
SYSC=/sysc
|
||||||
cp -R "${PREFIX}" "${SYSC}"
|
sys_transfer "${SYSC}" gzip patch
|
||||||
cp "${SOURCES}/helpers.sh" "${SOURCES}/SHA256SUMS.pkgs" "${SOURCES}/bootstrap.cfg" "${SYSC}/usr/src/"
|
|
||||||
exec chroot "${SYSC}" /init
|
exec chroot "${SYSC}" /init
|
||||||
|
|
12
sysb/run.sh
12
sysb/run.sh
|
@ -55,6 +55,10 @@ if [ -z "${DISK}" ] || ! [ -e "/dev/${DISK}" ]; then
|
||||||
ask_disk
|
ask_disk
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PREFIX=/usr
|
||||||
|
SOURCES="${PREFIX}/src"
|
||||||
|
SYSC=/sysc
|
||||||
|
|
||||||
echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg
|
echo "export DISK=${DISK}" >> /usr/src/bootstrap.cfg
|
||||||
|
|
||||||
# Otherwise, add stuff from sysa to sysb
|
# Otherwise, add stuff from sysa to sysb
|
||||||
|
@ -64,13 +68,7 @@ mount -t ext4 "/dev/${DISK}" /sysc
|
||||||
|
|
||||||
# Copy over appropriate data
|
# Copy over appropriate data
|
||||||
echo "Copying data into sysc"
|
echo "Copying data into sysc"
|
||||||
cp -r /dev /sysc/
|
sys_transfer "${SYSC}" gzip patch
|
||||||
mkdir -p /sysc/usr/src
|
|
||||||
# Don't include /usr/src
|
|
||||||
find /usr -mindepth 1 -maxdepth 1 -type d -not -name src -exec cp -r {} /sysc/{} \;
|
|
||||||
# Except for a few files
|
|
||||||
cp /usr/src/helpers.sh /usr/src/SHA256SUMS.pkgs /usr/src/bootstrap.cfg /sysc/usr/src/
|
|
||||||
cp -r /usr/src/repo /sysc/usr/src/repo
|
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# switch_root into sysc 1. for simplicity 2. to avoid kexecing again
|
# switch_root into sysc 1. for simplicity 2. to avoid kexecing again
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
SRCS="autoconf-2.69.tar.xz"
|
|
||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
rm doc/standards.info man/*.1
|
rm doc/standards.info man/*.1
|
||||||
autoreconf-2.64 -f
|
autoreconf-2.64 -f
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
SRCS="autoconf-2.71.tar.xz"
|
|
||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
rm doc/standards.info
|
rm doc/standards.info
|
||||||
autoreconf-2.69 -fi
|
autoreconf-2.69 -fi
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
SRCS="autoconf-archive-2021.02.19.tar.xz"
|
|
||||||
|
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
autoreconf-2.69 -fi
|
autoreconf-2.69 -fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ src_prepare() {
|
||||||
|
|
||||||
# Rebuild configure script
|
# Rebuild configure script
|
||||||
rm configure
|
rm configure
|
||||||
autoconf-2.61
|
autoconf-2.64
|
||||||
|
|
||||||
# avoid non-deterministic build:
|
# avoid non-deterministic build:
|
||||||
printf '%s\n%s\n' \
|
printf '%s\n%s\n' \
|
||||||
|
|
42
sysc/init
42
sysc/init
|
@ -6,9 +6,51 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# shellcheck source=sysa/helpers.sh
|
||||||
|
. helpers.sh
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Installing packages into sysc"
|
||||||
|
|
||||||
|
install_tar() {
|
||||||
|
echo "${1}: installing package"
|
||||||
|
src_apply_tar "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install packages.
|
||||||
|
# First two packages must be coreutils and sed
|
||||||
|
|
||||||
|
install_tar coreutils-5.0 0
|
||||||
|
install_tar sed-4.0.9 0
|
||||||
|
|
||||||
|
install_tar autoconf-2.64 0
|
||||||
|
install_tar automake-1.10.3 0
|
||||||
|
install_tar binutils-2.14 0
|
||||||
|
install_tar bzip2-1.0.8 0
|
||||||
|
install_tar bison-3.4.1 2
|
||||||
|
install_tar coreutils-6.10 0
|
||||||
|
install_tar diffutils-2.7 0
|
||||||
|
install_tar findutils-4.2.33 0
|
||||||
|
install_tar flex-2.6.4 0
|
||||||
|
install_tar gawk-3.0.4 0
|
||||||
|
install_tar gcc-4.0.4 1
|
||||||
|
install_tar grep-2.4 0
|
||||||
|
install_tar help2man-1.36.4 0
|
||||||
|
install_tar libtool-2.2.4 0
|
||||||
|
install_tar linux-headers-5.10.41 0
|
||||||
|
install_tar m4-1.4.7 0
|
||||||
|
install_tar make-3.82 0
|
||||||
|
install_tar musl-1.2.2 0
|
||||||
|
install_tar perl-5.6.2 0
|
||||||
|
install_tar util-linux-2.19.1 0
|
||||||
|
|
||||||
|
# Fix invocation of bash from perl
|
||||||
|
ln -s /usr/bin/bash /usr/bin/sh
|
||||||
|
|
||||||
# Prepare sysc directory structure
|
# Prepare sysc directory structure
|
||||||
mkdir -p /usr/src
|
mkdir -p /usr/src
|
||||||
mv run*.sh /usr/src
|
mv run*.sh /usr/src
|
||||||
|
mv helpers.sh SHA256SUMS.pkgs bootstrap.cfg /usr/src
|
||||||
mv /*-* /usr/src # build scripts
|
mv /*-* /usr/src # build scripts
|
||||||
|
|
||||||
# Begin sysc bootstrapping process
|
# Begin sysc bootstrapping process
|
||||||
|
|
|
@ -20,7 +20,7 @@ export DISTFILES=/distfiles
|
||||||
create_fhs() {
|
create_fhs() {
|
||||||
# Add the rest of the FHS that we will use and is not created pre-boot
|
# Add the rest of the FHS that we will use and is not created pre-boot
|
||||||
rm -rf /sbin /usr/sbin
|
rm -rf /sbin /usr/sbin
|
||||||
ln -s bin /usr/sbin
|
ln -s bin /usr/sbin # Hack to fix xbps (alternatively need to install which)
|
||||||
for d in bin lib sbin; do
|
for d in bin lib sbin; do
|
||||||
ln -s "usr/${d}" "/${d}"
|
ln -s "usr/${d}" "/${d}"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue