add root user to emergency shell

This commit is contained in:
Tobias Powalowski 2023-02-13 07:50:18 +01:00
parent fee92fe794
commit 1c06bc1aed
2 changed files with 6 additions and 7 deletions

View file

@ -19,19 +19,18 @@ build() {
map add_file '/usr/lib/udev/ata_id' '/usr/lib/udev/scsi_id' map add_file '/usr/lib/udev/ata_id' '/usr/lib/udev/scsi_id'
add_file "/usr/share/archboot/base/init" "/init" add_file "/usr/share/archboot/base/init" "/init"
map add_dir /mnt /cdrom map add_dir /mnt /cdrom
map add_file /etc/bash.bash_logout /etc/bash.bashrc /etc/profile /etc/shells map add_file /etc/bash.bash_logout /etc/bash.bashrc
# add default bash setup
for i in .bashrc .bash_profile .bash_logout; do
add_file "/etc/skel/${i}" "/root/${i}"
done
# add custom bash options # add custom bash options
echo ". /etc/profile.d/custom-bash-options.sh" >> "$BUILDROOT/root/.bashrc" echo ". /etc/profile.d/custom-bash-options.sh" >> "$BUILDROOT/etc/bash.bashrc"
echo "root:x:0:root" > "$BUILDROOT/etc/group"
echo "root:x:0:0:/root:/bin/bash" > "$BUILDROOT/etc/passwd"
add_file "/usr/share/archboot/base/etc/profile.d/custom-bash-options.sh" \ add_file "/usr/share/archboot/base/etc/profile.d/custom-bash-options.sh" \
"/etc/profile.d/custom-bash-options.sh" "/etc/profile.d/custom-bash-options.sh"
basic_config="os-release hostname modprobe.d/modprobe.conf" basic_config="os-release hostname modprobe.d/modprobe.conf"
for i in $basic_config; do for i in $basic_config; do
add_file "/usr/share/archboot/base/etc/${i}" "/etc/${i}" add_file "/usr/share/archboot/base/etc/${i}" "/etc/${i}"
done done
} }
help() { help() {

View file

@ -52,7 +52,7 @@ if ! [[ -f "/mnt/boot/initramfs-$(uname -m).img" ]] ; then
echo -e "\e[1mStep 3/4:\e[m Searching for archboot rootfs on cdrom device..." echo -e "\e[1mStep 3/4:\e[m Searching for archboot rootfs on cdrom device..."
mount /dev/sr0 /cdrom &>/dev/null mount /dev/sr0 /cdrom &>/dev/null
if ! mount /cdrom/efi.img /mnt &>/dev/null; then if ! mount /cdrom/efi.img /mnt &>/dev/null; then
echo -e "\e[1;91mError: Didn't find a device with archboot rootfs\!\e[m" echo -e "\e[1;91mError: Didn't find a device with archboot rootfs! \e[m"
echo -e "\e[1mThis needs further debugging. Please contact the archboot author.\e[m" echo -e "\e[1mThis needs further debugging. Please contact the archboot author.\e[m"
echo -e "\e[1mTobias Powalowski: tpowa@archlinux.org\e[m" echo -e "\e[1mTobias Powalowski: tpowa@archlinux.org\e[m"
echo "" echo ""