loongbedrocklinux-userlandd/src/slash-bedrock/share/brl-fetch/distros/exherbo-musl

84 lines
2.5 KiB
Plaintext

#!/bedrock/libexec/busybox sh
#
# Exherbo Linux bootstrap support
# Copyright 2019 Wulf C. Krueger <philantrop@exherbo.org>
# Distributed under the terms of the GNU General Public License v2
#
# based in part upon "Gentoo Linux bootstrap support" which is:
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# Copyright (c) 2016-2019 Daniel Thau <danthau@bedrocklinux.org>
# shellcheck source=src/slash-bedrock/libexec/brl-fetch
. /bedrock/share/common-code
trap 'fetch_abort "Unexpected error occurred."' EXIT
check_supported() {
true
}
speed_test_url() {
echo "/index.html"
}
list_mirrors() {
echo "https://dev.exherbo.org/"
}
brl_arch_to_distro() {
case "${1}" in
"x86_64") echo "x86_64" ;;
*) abort "brl does not know how to translate arch \"${1}\" to ${distro} format" ;;
esac
}
list_architectures() {
cat <<EOF
x86_64
EOF
}
default_release() {
echo "rolling"
}
list_releases() {
echo "rolling"
}
fetch() {
paludis_builddir=/var/tmp/paludis/build
paludis_user=paludisbuild
paludis_group=paludisbuild
ex_stage="exherbo-x86_64-pc-linux-musl-current.tar.xz"
ex_checksum_fn=sha256sum
step "Downloading & verifying bootstrap software"
download "${target_mirror}"/stages/${ex_stage}."${ex_checksum_fn}" "${bootstrap_dir}/${ex_stage}.${ex_checksum_fn}"
ex_sha256sum="$(awk -v"name=exherbo" '/^# .* HASH$/ {hash=$1;next} index($2, name) {print$1;exit}' "${bootstrap_dir}/${ex_stage}.${ex_checksum_fn}")"
checksum_download "${cache}/${ex_stage}" "sha256sum" "${ex_sha256sum}" "${target_mirror}"/stages/"${ex_stage}"
step "Preparing bootstrap software"
tar xvJp -C "${bootstrap_dir}" -f "${cache}"/"${ex_stage}" | awk 'NR%100==0' | progress_unknown
step "Running bootstrap software"
setup_chroot "${bootstrap_dir}"
setup_ssl "${bootstrap_dir}"
share_cache "." "${bootstrap_dir}/tarballs"
chroot "${bootstrap_dir}" sh -c "cd /target-root && tar xvJpf /tarballs/${ex_stage}" | awk 'NR%100==0' | progress_unknown
step "Configuring"
setup_chroot "${target_dir}"
step "Creating Paludis' build-dir & fixing permissions"
mkdir -p "${target_dir}/${paludis_builddir}/"
chroot "${target_dir}" chown -R "${paludis_user}":"${paludis_group}" "${paludis_builddir}"
chroot "${target_dir}" chmod -R g+rwx "${paludis_builddir}"
step "Modifying ${paludis_user}"
chroot "${target_dir}" usermod -a -G "$(stat -c %G /dev/tty)" ${paludis_user}
}