Fixing up few issues, adding resolv.conf linking to chroot script
This commit is contained in:
parent
f849284043
commit
a8b0feb57d
@ -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
|
||||||
@ -138,7 +135,7 @@ export MP_ROOT="$TARGET" MP_YES=1
|
|||||||
openssl sed shadow tar tcl mandb \
|
openssl sed shadow tar tcl mandb \
|
||||||
man-pages tzdata util-linux which \
|
man-pages tzdata util-linux which \
|
||||||
mp gettext iproute procps psmisc \
|
mp gettext iproute procps psmisc \
|
||||||
mandb kbd dbus vim nano libxml2
|
mandb kbd dbus vim nano libxml2
|
||||||
check_ret "mp-install command failed"
|
check_ret "mp-install command failed"
|
||||||
unset MP_ROOT MP_YES
|
unset MP_ROOT MP_YES
|
||||||
success "Installed the base system"
|
success "Installed the base system"
|
||||||
|
@ -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,13 +46,15 @@ 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)
|
||||||
else
|
else
|
||||||
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 \
|
||||||
|
@ -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,20 +178,18 @@ 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"
|
|
||||||
|
|
||||||
if [ ! -z "${PKGS1}" ]; then
|
if [ ! -z "${PKGS1}" ]; then
|
||||||
info "Installing extra packages (1)"
|
info "Installing extra packages (1)"
|
||||||
matter-chroot "$TMPDIR" mp-sync
|
matter-chroot "$TMPDIR" mp-sync
|
||||||
check_retc "Sync failed"
|
check_retc "Sync failed"
|
||||||
|
|
||||||
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"
|
||||||
|
Loading…
Reference in New Issue
Block a user