Fixing up few issues, adding resolv.conf linking to chroot script

This commit is contained in:
ngn 2024-01-18 15:51:19 +03:00
parent f849284043
commit a8b0feb57d
3 changed files with 24 additions and 31 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# matter-base | Matterlinux Release Archive Script # matter-base | Matterlinux Release Archive Build Script
# Copyright (C) 2023 Matterlinux # Copyright (C) 2023 Matterlinux
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -120,9 +120,6 @@ EOF
127.0.0.1 localhost 127.0.0.1 localhost
::1 localhost ::1 localhost
EOF EOF
cp /etc/mp/cfg etc/mp/cfg
#cp ~/.gnupg/pubring.kbx root/.gnupg/pubring.kbx
popd > /dev/null popd > /dev/null
export MP_ROOT="$TARGET" MP_YES=1 export MP_ROOT="$TARGET" MP_YES=1

View File

@ -31,6 +31,12 @@ error() {
#################### ####################
## util functions ## ## util functions ##
#################### ####################
linkresolv(){
if [ ! -f "$TARGET/etc/resolv.conf" ]; then
ln -sf /run/systemd/resolve/resolv.conf "$TARGET/etc/resolv.conf"
fi
}
chrt() { chrt() {
mount -t proc proc "$TARGET/proc" mount -t proc proc "$TARGET/proc"
mount -t sysfs sysfs "$TARGET/sys" mount -t sysfs sysfs "$TARGET/sys"
@ -40,7 +46,8 @@ chrt() {
mount -o bind /dev "$TARGET/dev" mount -o bind /dev "$TARGET/dev"
mount -t devpts none "$TARGET/dev/pts" mount -t devpts none "$TARGET/dev/pts"
mount -t tmpfs tmpfs "$TARGET/run" mount --bind /run "$TARGET/run"
linkresolv
if [ -h $TARGET/dev/shm ]; then if [ -h $TARGET/dev/shm ]; then
mkdir -p $TARGET/$(readlink $TARGET/dev/shm) mkdir -p $TARGET/$(readlink $TARGET/dev/shm)
@ -48,6 +55,7 @@ chrt() {
mount -t tmpfs -o nosuid,nodev tmpfs "$TARGET/dev/shm" mount -t tmpfs -o nosuid,nodev tmpfs "$TARGET/dev/shm"
fi fi
local prompt='\['$BOLD'\['$RED'(chroot)\['$RESET'\['$BOLD' \u@\h:\w#\['$RESET' ' local prompt='\['$BOLD'\['$RED'(chroot)\['$RESET'\['$BOLD' \u@\h:\w#\['$RESET' '
chroot "$TARGET" /usr/bin/env -i \ chroot "$TARGET" /usr/bin/env -i \
HOME=/root \ HOME=/root \

View File

@ -73,18 +73,10 @@ check_retc() {
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
errorne "$1" errorne "$1"
clean_tmpdir clean_tmpdir
exit 1
fi fi
} }
setup_dns() {
info "Setting up DNS"
echo "nameserver 1.1.1.1" >> "$TMPDIR/etc/resolv.conf"
}
clean_dns(){
rm "$TMPDIR/etc/resolv.conf"
}
clean_tmpdir(){ clean_tmpdir(){
if [ -d $TMPDIR ]; then if [ -d $TMPDIR ]; then
info "Cleaning up temp directory" info "Cleaning up temp directory"
@ -186,7 +178,6 @@ for p2 in "${PKGS2[@]}"; do
fi fi
done done
setup_dns
info "Adding public keys" info "Adding public keys"
matter-chroot "$TMPDIR" gpg --receive-keys $keys_str matter-chroot "$TMPDIR" gpg --receive-keys $keys_str
check_retc "Failed to add public keys" check_retc "Failed to add public keys"
@ -199,7 +190,6 @@ setup_dns
matter-chroot "$TMPDIR" MP_YES=1 mp-install $pkgs1_str matter-chroot "$TMPDIR" MP_YES=1 mp-install $pkgs1_str
check_retc "Install failed" check_retc "Install failed"
fi fi
clean_dns
info "Running build script" info "Running build script"
echo "source /iso.sh && build" > "$TMPDIR/stager.sh" echo "source /iso.sh && build" > "$TMPDIR/stager.sh"
@ -218,10 +208,8 @@ popd > /dev/null
if [ ! -z "${PKGS2}" ]; then if [ ! -z "${PKGS2}" ]; then
info "Installing extra packages (2)" info "Installing extra packages (2)"
setup_dns
matter-chroot "$TMPDIR" MP_YES=1 mp-install $pkgs2_str matter-chroot "$TMPDIR" MP_YES=1 mp-install $pkgs2_str
check_ret "Install failed" check_ret "Install failed"
clean_dns
fi fi
info "Copying over the bootdir" info "Copying over the bootdir"