Improve bootstrap files
This commit is contained in:
parent
f39327b8c8
commit
dc8eed84f8
@ -8,11 +8,11 @@
|
||||
# Usage:
|
||||
#
|
||||
# # ./hyper-bootstrap.sh destination
|
||||
# # ./hyper-bootstrap.sh -a x86_64 -r https://repo.hyperbola.info:50011/gnu-plus-linux-libre/testing destination-64
|
||||
# # ./hyper-bootstrap.sh -a x86_64 -r https://repo.hyperbola.info:50012/gnu-plus-linux-libre/stable destination-64
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# # ./hyper-bootstrap.sh -a x86_64 -r "https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing" myhyper
|
||||
# # ./hyper-bootstrap.sh -a x86_64 -r "https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable" myhyper
|
||||
# # ./hyper-bootstrap.sh myhyper
|
||||
#
|
||||
# And then you can chroot to the destination directory (user: root, password: root):
|
||||
@ -35,7 +35,7 @@ PACMAN_PACKAGES=(
|
||||
libassuan libgpg-error libnghttp2 libssh2 lzo libressl pacman pacman-mirrorlist xz zlib libffi
|
||||
krb5 e2fsprogs keyutils libidn gcc-libs lz4 libpsl icu readline libunistring findutils
|
||||
ncurses pinentry lsb-release ca-certificates ca-certificates-utils p11-kit libtasn1
|
||||
libcap shadow pcre
|
||||
libcap shadow pcre gzip
|
||||
)
|
||||
CORE_PACKAGES=(${PACMAN_PACKAGES[*]} filesystem)
|
||||
COMMUNITY_PACKAGES=(lzip zstd)
|
||||
@ -75,7 +75,6 @@ uncompress() {
|
||||
*.gz)
|
||||
tar xzf "$FILEPATH" -C "$DEST";;
|
||||
*.xz)
|
||||
# tar xzf "$FILEPATH" -C "$DEST" ;;
|
||||
tar -xf "$FILEPATH" -C "$DEST" > /dev/null 2> /dev/null;;
|
||||
*.lz)
|
||||
tar xf "$FILEPATH" -C "$DEST";;
|
||||
@ -128,7 +127,6 @@ configure_pacman() {
|
||||
local DEST=$1 ARCH=$2
|
||||
debug "Configuring SERVER"
|
||||
SERVER=$(get_template_repo_url "$REPO_URL" "$ARCH")
|
||||
echo "Server = $SERVER" > "$DEST/etc/pacman.d/mirrorlist"
|
||||
debug "Configuring CERT"
|
||||
cp -fv certs/1.pem "$DEST/etc/ca-certificates/extracted/tls-ca-bundle.pem"
|
||||
}
|
||||
@ -137,6 +135,7 @@ clean_chroot() {
|
||||
local DEST=$1
|
||||
debug "Clean Chroot"
|
||||
rm -rf "$DEST/.BUILDINFO" "$DEST/.INSTALL" "$DEST/.MTREE" "$DEST/.PKGINFO" || true
|
||||
echo '' > "$DEST/var/log/pacman.log"
|
||||
}
|
||||
|
||||
configure_minimal_system() {
|
||||
@ -157,6 +156,14 @@ configure_minimal_system() {
|
||||
sed -i "s|^[[:space:]]*SigLevel[[:space:]]*=.*$|SigLevel = Never|" "$DEST/etc/pacman.conf"
|
||||
}
|
||||
|
||||
configure_locale() {
|
||||
local DEST=$1
|
||||
sed -e 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' -i "$DEST/etc/locale.gen"
|
||||
echo LANG=en_US.UTF-8 > "$DEST/etc/locale.conf"
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
locale-gen
|
||||
}
|
||||
|
||||
fetch_packages_list() {
|
||||
local REPO=$1
|
||||
|
||||
@ -210,7 +217,8 @@ install_packages() {
|
||||
local ARCH=$1 DEST=$2 PACKAGES=$3
|
||||
debug "Install packages: $PACKAGES"
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
/usr/bin/pacman --noconfirm --arch $ARCH -Syy --force $PACKAGES
|
||||
/usr/bin/pacman --noconfirm --noprogressbar --quiet --arch $ARCH -Syy --force $PACKAGES \
|
||||
&& /usr/bin/pacman --noconfirm --noprogressbar --quiet -Scc
|
||||
}
|
||||
|
||||
configure_keyring() {
|
||||
@ -219,7 +227,7 @@ configure_keyring() {
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
/usr/bin/pacman-key --init && /usr/bin/pacman-key --populate archlinux hyperbola \
|
||||
&& /usr/bin/pacman-key --refresh-keys \
|
||||
&& /usr/bin/pacman -Sy hyperbola-keyring --noconfirm
|
||||
&& /usr/bin/pacman -Sy hyperbola-keyring --noconfirm --noprogressbar --quiet
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
@ -271,6 +279,7 @@ main() {
|
||||
configure_minimal_system "$DEST"
|
||||
[[ -n "$USE_QEMU" ]] && configure_static_qemu "$ARCH" "$DEST"
|
||||
install_packages "$ARCH" "$DEST" "${CORE_PACKAGES[*]} ${EXTRA_PACKAGES[*]}"
|
||||
configure_locale "$DEST"
|
||||
configure_keyring "$DEST"
|
||||
clean_chroot "$DEST" # clean
|
||||
[[ -z "$PRESERVE_DOWNLOAD_DIR" ]] && rm -rf "$DOWNLOAD_DIR"
|
||||
|
@ -35,7 +35,7 @@ PACMAN_PACKAGES=(
|
||||
libassuan libgpg-error libnghttp2 libssh2 lzo libressl pacman pacman-mirrorlist xz zlib libffi
|
||||
krb5 e2fsprogs keyutils libidn2 gcc-libs lz4 libpsl icu zstd readline libunistring findutils
|
||||
ncurses pinentry-curses lsb-release ca-certificates ca-certificates-utils p11-kit libtasn1
|
||||
libcap shadow pcre
|
||||
libcap shadow pcre gzip
|
||||
)
|
||||
BASIC_PACKAGES=(${PACMAN_PACKAGES[*]} filesystem)
|
||||
EXTRA_PACKAGES=(gawk file tar hyperrc)
|
||||
@ -121,6 +121,7 @@ clean_chroot() {
|
||||
local DEST=$1
|
||||
debug "Clean Chroot"
|
||||
rm -rf "$DEST/.BUILDINFO" "$DEST/.INSTALL" "$DEST/.MTREE" "$DEST/.PKGINFO" || true
|
||||
echo '' > "$DEST/var/log/pacman.log"
|
||||
}
|
||||
|
||||
configure_minimal_system() {
|
||||
@ -141,6 +142,14 @@ configure_minimal_system() {
|
||||
sed -i "s|^[[:space:]]*SigLevel[[:space:]]*=.*$|SigLevel = Never|" "$DEST/etc/pacman.conf"
|
||||
}
|
||||
|
||||
configure_locale() {
|
||||
local DEST=$1
|
||||
sed -e 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' -i "$DEST/etc/locale.gen"
|
||||
echo LANG=en_US.UTF-8 > "$DEST/etc/locale.conf"
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
locale-gen
|
||||
}
|
||||
|
||||
fetch_packages_list() {
|
||||
local REPO=$1
|
||||
|
||||
@ -178,14 +187,15 @@ install_packages() {
|
||||
local ARCH=$1 DEST=$2 PACKAGES=$3
|
||||
debug "Install packages: $PACKAGES"
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
/usr/bin/pacman --noconfirm --arch $ARCH -Syy --force $PACKAGES
|
||||
/usr/bin/pacman --noconfirm --noprogressbar --quiet --arch $ARCH -Syy --force $PACKAGES \
|
||||
&& /usr/bin/pacman --noconfirm --noprogressbar --quiet -Scc
|
||||
}
|
||||
|
||||
configure_keyring() {
|
||||
local DEST=$1
|
||||
sed -i 's|SigLevel = Never|SigLevel = Required DatabaseOptional|' "$DEST/etc/pacman.conf"
|
||||
LC_ALL=C chroot "$DEST" \
|
||||
/usr/bin/pacman-key --init && /usr/bin/pacman-key --populate hyperbola
|
||||
/usr/bin/pacman-key --init && /usr/bin/pacman-key --populate hyperbola --noconfirm --noprogressbar --quiet
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
@ -235,6 +245,7 @@ main() {
|
||||
[[ -n "$USE_QEMU" ]] && configure_static_qemu "$ARCH" "$DEST"
|
||||
install_packages "$ARCH" "$DEST" "${BASIC_PACKAGES[*]} ${EXTRA_PACKAGES[*]}"
|
||||
configure_keyring "$DEST"
|
||||
configure_locale "$DEST"
|
||||
clean_chroot "$DEST" # clean
|
||||
[[ -z "$PRESERVE_DOWNLOAD_DIR" ]] && rm -rf "$DOWNLOAD_DIR"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user