Large update and cleanup, attempted fix for grub-install

This commit is contained in:
natemaia 2018-12-14 14:30:13 -08:00
parent f96435486a
commit a3c3ec6730
10 changed files with 106 additions and 81 deletions

View File

@ -119,10 +119,6 @@ _ExtPartBody1="\nWhere do you want the partition mounted?\n\nEnsure the name beg
_KernelTitle="Choose Kernel"
_KernelBody="\nSelect which kernel to use for the install."
# base-devel
_DevelTitle="Install base-devel packages"
_DevelBody="\nDo you want base-devel installed for compiling and building packages?"
# shell
_ShellTitle="Choose Login Shell"
_ShellBody="\nSelect which shell to use as the new user's login shell."

View File

@ -10,7 +10,7 @@
# immutable globals
readonly VER="1.7.29" # Installer version
readonly VER="1.7.30" # Installer version
readonly DIST="ArchLabs" # Linux distributor
readonly MNT="/mnt" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log

View File

@ -137,7 +137,10 @@ install_bootloader()
# install/setup the bootloader by running the BCMD (boot command)
printf "\nInstalling and setting up $BOOTLDR in ${BMNTS[$SYS-$BOOTLDR]}\n\n"
chrun "${BCMDS[$BOOTLDR]}"
mkdir -p $MNT/{hostrun,run/udev}
mount --bind /run $MNT/hostrun
chrun "mount --bind /hostrun/lvm /run/lvm; mount --bind /hostrun/udev /run/udev ${BCMDS[$BOOTLDR]}; umount /run/lvm; umount /run/udev"
echeck "${BCMDS[$BOOTLDR]}"
# copy efi stub to generic catch all

View File

@ -153,13 +153,10 @@ cfg_menu()
fi
select_mirrorcmd || return 1
yesno "$_DevelTitle" "$_DevelBody" && BASEDEV=true || BASEDEV=false
select_wm_or_de || return 1
select_packages || return 1
export CONFIG_DONE=true
CONFIG_DONE=true
return 0
}
@ -250,9 +247,9 @@ user_creation()
# recursively loop back unless the user cancels
user || return 1
else
export NEWUSER="$user"
export USER_PASS="$pass"
export ROOT_PASS="$rpass"
NEWUSER="$user"
USER_PASS="$pass"
ROOT_PASS="$rpass"
fi
return 0
}

View File

@ -9,6 +9,7 @@
# shellcheck disable=2153
readonly RUN="/run/archiso/bootmnt/arch/boot"
readonly SERVICE="$MNT/etc/systemd/system/getty@tty1.service.d"
readonly VM="$(dmesg | grep -i "hypervisor")"
install()
@ -116,6 +117,7 @@ EOF
# set the locale
printf "\n\n"
cat > $MNT/etc/locale.conf << EOF
LANG=$LOCALE
EOF
@ -201,34 +203,8 @@ create_user()
return 0
}
login_manager()
setup_xinit()
{
local service="$MNT/etc/systemd/system/getty@tty1.service.d"
# remove welcome message
sed -i '/printf/d' $MNT/root/.zshrc
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
rm -rf $service
chrun 'systemctl enable lightdm.service && systemctl set-default graphical.target'
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
# LightDM GTK+ Configuration
[greeter]
active-monitor=0
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
background=/usr/share/backgrounds/archlabs/archlabs.jpg
theme-name=Adwaita-dark
icon-theme-name=Adwaita
font-name=DejaVu Sans Mono 11
position=30%,end 50%,end
EOF
else # xinit login
if [[ -e $MNT/home/$NEWUSER/.xinitrc ]]; then
sed -i "s/openbox-session/${LOGIN_WM}/g" $MNT/home/$NEWUSER/.xinitrc
else
@ -236,10 +212,41 @@ EOF
fi
# automatic startx for login shells
local loginrc
case $MYSHELL in
*bash) local loginrc=".bash_profile" ;;
*zsh) local loginrc=".zprofile" ;;
*mksh) local loginrc=".profile" ;;
*bash)
loginrc=".bash_profile"
rm -rf $MNT/home/$NEWUSER/.{z,mksh}*
;;
*mksh)
loginrc=".profile"
rm -rf $MNT/home/$NEWUSER/.{z,bash}*
cat >> $MNT/home/$NEWUSER/.mkshrc << EOF
# colors in less (manpager)
export LESS_TERMCAP_mb=$'\e[01;31m'
export LESS_TERMCAP_md=$'\e[01;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[01;32m'
export EDITOR=vim
export MANWIDTH=100
# source shell configs
for f in "\$HOME/.mksh/"*?.sh; do
. "\$f"
done
al-info
EOF
;;
*)
loginrc=".zprofile"
rm -rf $MNT/home/$NEWUSER/.{bash,mksh}*
esac
# add the shell login file to the edit list after install
@ -255,10 +262,40 @@ if [ -z "\$DISPLAY" ] && [ \$XDG_VTNR -eq 1 ]; then
fi
EOF
if [[ $AUTOLOGIN == true ]]; then
sed -i "s/root/${NEWUSER}/g" $service/autologin.conf
sed -i "s/root/${NEWUSER}/g" $SERVICE/autologin.conf
else
rm -rf $service
rm -rf $SERVICE
fi
}
setup_lightdm()
{
rm -rf $SERVICE
chrun 'systemctl set-default graphical.target && systemctl enable lightdm.service'
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
# LightDM GTK+ Configuration
[greeter]
active-monitor=0
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
background=/usr/share/backgrounds/archlabs/archlabs.jpg
theme-name=Adwaita-dark
icon-theme-name=Adwaita
font-name=DejaVu Sans Mono 11
position=30%,end 50%,end
EOF
}
login_manager()
{
# remove welcome message
sed -i '/printf/d' $MNT/root/.zshrc
if [[ $LOGIN_TYPE == 'lightdm' ]]; then
setup_lightdm
else
setup_shell_xinit
fi
}
@ -326,22 +363,9 @@ package_operations()
fi
chrun "pacman -Syyu --noconfirm"
# base-devel and git are the users choice
if [[ $BASEDEV == true ]]; then
chrun "pacman -S iputils --noconfirm" 2>/dev/null
chrun "pacman -S base-devel git --needed --noconfirm" 2>/dev/null
elif [[ $INSTALL_WMS =~ dwm ]]; then
chrun "pacman -S iputils git make --noconfirm" 2>/dev/null
else
# iputils is needed and should always be installed
chrun "pacman -S iputils --noconfirm" 2>/dev/null
fi
# install chosen packages
chrun "pacman -S $inpkg --needed --noconfirm"
# remove packages: installer, linux?, grub?
chrun "pacman -Rs $rmpkg --noconfirm"
return 0

View File

@ -117,7 +117,7 @@ luks_default()
cryptsetup open $LUKS_PART "$LUKS_NAME" <<< "$LUKS_PASS" 2>$ERR
echeck "cryptsetup open $LUKS_PART $LUKS_NAME"
export LUKS=' encrypted'
LUKS=' encrypted'
luks_show
return 0
}

View File

@ -6,7 +6,7 @@
# this file is not meant to be run directly
# sourcing this file in a non bash shell is not advised
# shellcheck disable=2154
# shellcheck disable=2154,2034
declare -g LVM=""
declare -g VOL_GROUP_MB=0
@ -264,7 +264,7 @@ lvm_del_all()
for i in $PHYSICAL_VOLUMES; do
pvremove -f "$i" >/dev/null 2>&1
done
export LVM=' logical volume'
LVM=' logical volume'
fi
return 0

View File

@ -6,16 +6,21 @@
# this file is not meant to be run directly
# sourcing this file in a non bash shell is not advised
# shellcheck disable=2154,2153,2046
# shellcheck disable=2154,2153,2046,2034
readonly SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024)"M"}' /proc/meminfo)"
readonly LOCALES="$(awk '/\.UTF-8/ { gsub(/# .*|#/, "")
readonly LOCALES="$(awk '/\.UTF-8/ {
gsub(/# .*|#/, "")
if ($1) {
print $1 " -"
}
}' /etc/locale.gen)"
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' |
awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}')"
readonly CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{
gsub(/\.map\.gz|.*\//, "")
print $1 " -"
}')"
mnt_menu()
{
@ -123,11 +128,11 @@ select_boot_setup()
BCMDS[syslinux]="efibootmgr -c -d $BOOT_DEVICE -p $BOOT_PART_NUM -l /EFI/syslinux/syslinux.efi -L $DIST"
fi
else
export FILES[9]="/etc/default/grub"
FILES[9]="/etc/default/grub"
if [[ $SYS == 'UEFI' ]]; then
local ttype="i386-efi"
[[ $IS_64BIT == true ]] && ttype='x86_64-efi'
BCMDS[grub]+=" --target=$ttype --efi-directory=${BMNTS[$SYS-$BOOTLDR]} --bootloader-id=$DIST"
BCMDS[grub]+=" --target=$ttype --efi-directory=${BMNTS[$SYS-grub]} --bootloader-id=$DIST"
else
BCMDS[grub]+=" --target=i386-pc $BOOT_DEVICE"
fi
@ -141,7 +146,7 @@ select_boot_setup()
src /usr/share/archlabs/installer/lib/boot.sh
return 1
fi
export SEPERATE_BOOT=true
SEPERATE_BOOT=true
fi
return 0

View File

@ -6,7 +6,7 @@
# this file is not meant to be run directly
# sourcing this file in a non bash shell is not advised
# shellcheck disable=2154,2155,2153,2046
# shellcheck disable=2154,2155,2153,2046,2034
declare -Agr FS_CMDS=(
[ext2]="mkfs.ext2 -q" [ext3]="mkfs.ext3 -q" [ext4]="mkfs.ext4 -q"
@ -179,7 +179,7 @@ check_cryptlvm()
done
elif [[ $(lsblk -lno TYPE "$part") =~ 'lvm' ]]; then
export LVM=' logical volume'
LVM=' logical volume'
VOLUME_NAME="${part#/dev/mapper/}"
for dev in $(awk '/crypt/ && /lvm2_member/ {print "/dev/mapper/"$1}' <<< "$devs" | uniq); do
@ -192,7 +192,7 @@ check_cryptlvm()
if grep -q "$LUKS_NAME" <<< "$(lsblk -lno NAME "$dev")"; then
LUKS_UUID="$(lsblk -lno UUID,TYPE,FSTYPE "$dev" | awk '/part/ && /crypto_LUKS/ {print $1}')"
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
export LUKS=' encrypted'
LUKS=' encrypted'
break
fi
done

View File

@ -142,7 +142,7 @@ system_identify()
if [[ -d $efidir ]]; then
SYS="UEFI"
[[ $(cat $efidir/fw_platform_size) == 64 ]] && export IS_64BIT=true
[[ $(cat $efidir/fw_platform_size) == 64 ]] && IS_64BIT=true
if ! grep -q $efidir/efivars <<< "$(mount)"; then
mount -t efivarfs efivarfs $efidir/efivars
@ -232,7 +232,7 @@ debug()
set -x
exec 3>| $DBG
BASH_XTRACEFD=3
export DEBUG=true
DEBUG=true
}
umount_dir()