Initial work on nvidia driver setup

- whitespace around > redirection paths
- live session changes/improvments
- use getopts for argument parsing
This commit is contained in:
natemaia 2019-10-19 15:18:42 -07:00
parent 122b7d6794
commit 6cc6c6d095

View File

@ -3,25 +3,30 @@
# This program is free software, provided under the GNU GPL # This program is free software, provided under the GNU GPL
# Written by Nathaniel Maia for use in Archlabs # Written by Nathaniel Maia for use in Archlabs
# Some ideas and code reworked from other resources # Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due # AIF, Calamares, and the Arch Wiki.. Credit where credit is due
VER=2.0.86 # check for syntax errors
# set -n
VER=2.0.89
# bulk default values { # bulk default values {
: ${DIST=ArchLabs} # distro name if not set : ${DIST=ArchLabs} # distro name if not set
MNT=/mnt # install mountpoint MNT=/mnt # installation root mountpoint
ANS=/tmp/ans # dialog answer file ANS=/tmp/ans # dialog answer output file
BOOTDIR=boot # location to mount boot partition BOOTDIR=boot # location to mount boot partition
FONT=ter-i16n # font used for the linux console FONT=ter-i16n # font used for the linux console
HOOKS=shutdown # list of additional mkinitcpio HOOKS HOOKS=shutdown # additional mkinitcpio HOOKS
SEL=0 # currently selected menu item SEL=0 # currently selected menu item
SYS=Unknown # bios type to be determined: UEFI/BIOS SYS=Unknown # bios type, to be determined: UEFI/BIOS
ERR=/tmp/errlog # error log used internally ERR=/tmp/errlog # stderr log used internally by errshow()
DBG=/tmp/debuglog # debug log when passed -d DBG=/tmp/debuglog # debug log file when passed -d
RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot RUN=/run/archiso/bootmnt/arch/boot # path for live system /boot
VM="$(dmesg | grep -i hypervisor)" # system running in a virtual machine VM="$(dmesg | grep -i hypervisor)" # system running in a virtual machine
export DIALOGOPTS="--cr-wrap" # see `man dialog` EXMNTS="" # extra partitions that were mounted, used to verify mountpoint and show user
FORMATTED="" # partitions that have been formatted, allows skipping the format step
export DIALOGOPTS="--cr-wrap" # dialog environment variable to hold default options, see `man dialog`
BASE_PKGS="base xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler " BASE_PKGS="base xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler "
BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot xdg-user-dirs " BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot xdg-user-dirs "
@ -172,18 +177,18 @@ main()
(( SEL < 12 )) && (( SEL++ )) (( SEL < 12 )) && (( SEL++ ))
tput civis tput civis
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \ dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " --default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
1 "Device tree (optional)" \ 1 "Show device tree" \
2 "Partitioning (optional)" \ 2 "Partitioning helpers" \
3 "LUKS setup (optional)" \ 3 "LUKS encryption setup" \
4 "LVM setup (optional)" \ 4 "Logical volume management setup" \
5 "Mount partitions" \ 5 "* Mount system partitions" \
6 "System bootloader" \ 6 "* Select system bootloader" \
7 "User and password" \ 7 "* Create user and password" \
8 "System configuration" \ 8 "* Basic system configuration" \
9 "Select WM/DE (optional)" \ 9 "Select window manager or desktop" \
10 "Select Packages (optional)" \ 10 "Select additional packages" \
11 "View configuration (optional)" \ 11 "View configuration selections" \
12 "Start the installation" 2>"$ANS" 12 "* Confirm choices and start the installation" 2> "$ANS"
read -r SEL < "$ANS" read -r SEL < "$ANS"
[[ -z $WARN && $SEL =~ (2|5) ]] && { msg "Data Warning" "$_warn"; WARN=true; } [[ -z $WARN && $SEL =~ (2|5) ]] && { msg "Data Warning" "$_warn"; WARN=true; }
@ -573,15 +578,7 @@ part_menu()
part_shrink "$device" part_shrink "$device"
elif [[ $choice == 'auto' ]]; then elif [[ $choice == 'auto' ]]; then
local root_size txt table boot_fs local root_size txt table boot_fs
root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 { root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 {if ($1 ~ "G") {sub(/G/, ""); print ($1 * 1000 - 512) / 1000 "G"} else {sub(/M/, ""); print ($1 - 512) "M"}}')
if ($1 ~ "G") {
sub(/G/, "")
print ($1 * 1000 - 512) / 1000 "G"
} else {
sub(/M/, "")
print ($1 - 512) "M"
}
}')
txt="\nWARNING:\n\nALL data on $device will be destroyed and the following partitions will be created\n\n- " txt="\nWARNING:\n\nALL data on $device will be destroyed and the following partitions will be created\n\n- "
if [[ $SYS == 'BIOS' ]]; then if [[ $SYS == 'BIOS' ]]; then
table="msdos" boot_fs="ext4" table="msdos" boot_fs="ext4"
@ -1134,6 +1131,8 @@ install_main()
errshow 1 "genfstab -U $MNT > $MNT/etc/fstab" errshow 1 "genfstab -U $MNT > $MNT/etc/fstab"
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab"
install_packages install_packages
# video driver tearfree configs, MUST be done after package install to support nvidia
install_tearfree_conf "$MNT/etc/X11/xorg.conf.d"
install_mkinitcpio install_mkinitcpio
install_boot install_boot
chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa"
@ -1183,49 +1182,28 @@ install_base()
trap - EXIT trap - EXIT
unset BG_PID unset BG_PID
# archiso files
rm -rf "$MNT/etc/mkinitcpio-archiso.conf" rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
# remove/disable customizations done to airootfs during building
chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
rm -f "$MNT/etc/systemd/scripts/choose-mirror"
rm -f "$MNT/etc/systemd/system/"{choose-mirror.service,etc-pacman.d-gnupg.mount,pacman-init.service}
sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf" sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
sed -i 's/#\(HandleSuspendKey=\)ignore/\1suspend/' "$MNT/etc/systemd/logind.conf"
sed -i 's/#\(HandleHibernateKey=\)ignore/\1hibernate/' "$MNT/etc/systemd/logind.conf"
sed -i 's/#\(HandleLidSwitch=\)ignore/\1suspend/' "$MNT/etc/systemd/logind.conf"
find "$MNT/boot" -name '*-ucode.img' -delete find "$MNT/boot" -name '*-ucode.img' -delete
# changing distro name?
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release} [[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
if [[ $VM ]]; then # vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
echo "Virtual machine detected, removing xorg configs"
find "$MNT/etc/X11/xorg.conf.d/" -name '*.conf' -delete -printf "remove %p\n"
elif lspci | grep ' VGA ' | grep -q 'Intel'; then
echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
cat > "$MNT/etc/X11/xorg.conf.d/20-intel.conf" <<- EOF
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
EOF
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX'; then # newer RX cards can use the amdgpu driver
echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf"
cat > "$MNT/etc/X11/xorg.conf.d/20-amdgpu.conf" <<- EOF
Section "Device"
Identifier "AMD Graphics"
Driver "amdgpu"
Option "TearFree" "true"
EndSection
EOF
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver
echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf"
cat > "$MNT/etc/X11/xorg.conf.d/20-radeon.conf" <<- EOF
Section "Device"
Identifier "AMD Graphics"
Driver "radeon"
Option "TearFree" "on"
EndSection
EOF
fi
if [[ -e /run/archiso/sfs/airootfs ]]; then
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> $ERR 2>&1 cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> $ERR 2>&1
errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux" errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux"
fi
# copy network settings
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/" [[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/"
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/" [[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/"
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/" [[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/"
@ -1255,6 +1233,7 @@ install_base()
BACKSPACE="guess" BACKSPACE="guess"
EOF EOF
printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > "$MNT/etc/vconsole.conf" printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > "$MNT/etc/vconsole.conf"
echo "$MYHOST" > "$MNT/etc/hostname" echo "$MYHOST" > "$MNT/etc/hostname"
cat > "$MNT/etc/hosts" <<- EOF cat > "$MNT/etc/hosts" <<- EOF
127.0.0.1 localhost 127.0.0.1 localhost
@ -1311,9 +1290,12 @@ install_boot()
install_user() install_user()
{ {
local groups='audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' local groups='audio,video,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
if [[ -e $MNT/etc/X11/xorg.conf.d/20-nvida.conf && -e $MNT/usr/bin/optirun ]]; then
groups+=',bumblebee'
fi
rm -f "$MNT/root/.zshrc" # remove welcome message from root zshrc rm -f "$MNT/root/.zlogin" # remove welcome message
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> $ERR 2>&1 chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> $ERR 2>&1
errshow 1 "set root password" errshow 1 "set root password"
@ -1330,8 +1312,6 @@ install_user()
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> $ERR 2>&1 chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> $ERR 2>&1
errshow 1 "set $NEWUSER password" errshow 1 "set $NEWUSER password"
chrun "pamixer --unmute; gtk-update-icon-cache /usr/share/icons/ArchLabs-Dark /usr/share/icons/ArchLabs-Light /usr/share/icons/ArchLabs"
if [[ $INSTALL_WMS == *dwm* ]];then if [[ $INSTALL_WMS == *dwm* ]];then
install_suckless "/home/$NEWUSER" chroot install_suckless "/home/$NEWUSER" chroot
[[ $INSTALL_WMS == 'dwm' ]] && rm -rf "$MNT/home/$NEWUSER/.config/xfce4" [[ $INSTALL_WMS == 'dwm' ]] && rm -rf "$MNT/home/$NEWUSER/.config/xfce4"
@ -1406,17 +1386,24 @@ install_packages()
rmpkg+="archlabs-installer " rmpkg+="archlabs-installer "
fi fi
if [[ $VM ]] && dmesg | grep -qi 'vbox'; then
inpkg+="virtualbox-guest-utils "
case "$KERNEL" in
linux) inpkg+="virtualbox-guest-modules-arch " ;;
*) inpkg+="virtualbox-guest-modules-dkms ${KERNEL}-headers " ;;
esac
fi
if [[ $MYSHELL == 'zsh' ]]; then if [[ $MYSHELL == 'zsh' ]]; then
inpkg+="zsh-completions " inpkg+="zsh-completions "
else else
rmpkg+="zsh " rmpkg+="zsh "
fi fi
if [[ $INSTALL_WMS == 'dwm' ]]; then # dwm only needs a very limited package set if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]]; then
inpkg+="$WM_BASE_PKGS "
elif [[ $INSTALL_WMS == 'dwm' ]]; then # dwm only needs a very limited package set
inpkg+="nitrogen polkit-gnome gnome-keyring dunst " inpkg+="nitrogen polkit-gnome gnome-keyring dunst "
else
[[ $INSTALL_WMS =~ (plasma|gnome|cinnamon) ]] || inpkg+="archlabs-ksuperkey "
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS "
fi fi
# update and install crucial packages first to avoid issues # update and install crucial packages first to avoid issues
@ -1452,6 +1439,32 @@ install_packages()
return 0 return 0
} }
install_suckless()
{
local dir="$1/suckless"
shift
if [[ $2 == 'chroot' ]]; then
chrun "mkdir -pv '$dir'"
for i in dwm dmenu st; do
if chrun "git clone 'https://git.suckless.org/$i' '$dir/$i'"; then
chrun "cd '$dir/$i' && make PREFIX=/usr install"
else
printf "failed to clone %s repo\n" "$i"
fi
done
else
mkdir -pv "$dir"
for i in dwm dmenu st; do
if git clone "https://git.suckless.org/$i" "$dir/$i"; then
cd "$dir/$i" && make PREFIX=/usr install
else
printf "failed to clone %s repo\n" "$i"
fi
done
fi
}
install_mkinitcpio() install_mkinitcpio()
{ {
local add='' local add=''
@ -1486,8 +1499,6 @@ install_mirrorlist()
fi fi
curl -fsSL "$mirror" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 6 - > "$1" curl -fsSL "$mirror" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 6 - > "$1"
fi fi
return 0
} }
install_background() install_background()
@ -1497,30 +1508,73 @@ install_background()
trap "kill $BG_PID 2> /dev/null" EXIT trap "kill $BG_PID 2> /dev/null" EXIT
} }
install_suckless() install_tearfree_conf()
{ {
local dir="$1/suckless" local xpath="$1"
shift
if [[ $2 == 'chroot' ]]; then if [[ $VM ]]; then
chrun "mkdir -pv '$dir'" echo "Virtual machine detected, removing xorg configs"
for i in dwm dmenu st; do find "$xpath/" -name '*.conf' -delete -printf "remove %p\n"
if chrun "git clone 'https://git.suckless.org/$i' '$dir/$i'"; then elif lspci | grep ' VGA ' | grep -q 'Intel'; then
chrun "cd '$dir/$i' && make PREFIX=/usr install" echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
cat > "$xpath/20-intel.conf" <<- EOF
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
EOF
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX\|AMD/ATI.*R[579]'; then # newer RX, R5, R7, and R9 cards can use the amdgpu driver
echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf"
cat > "$xpath/20-amdgpu.conf" <<- EOF
Section "Device"
Identifier "AMD Graphics"
Driver "amdgpu"
Option "TearFree" "true"
EndSection
EOF
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver
echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf"
cat > "$xpath/20-radeon.conf" <<- EOF
Section "Device"
Identifier "AMD Graphics"
Driver "radeon"
Option "TearFree" "on"
EndSection
EOF
elif lspci | grep ' VGA ' | grep -q 'NVIDIA'; then # nvidia cards require a bit of checking for notebook gpus
echo "Trying nvidia driver install"
if lspci | grep ' VGA ' | grep -q 'Intel\|AMD' && lspci | grep ' VGA ' | grep -q 'NVIDIA.*[6-9][1-8][05]M[X]\?\|NVIDIA.*Quadro.*[KMP][1-6][0-2][0]*M'; then # optimus
if [[ $xpath == *"$MNT"* ]]; then
chrun "nvidia-installer --bumblebee"
else else
printf "failed to clone %s repo\n" "$i" nvidia-installer --bumblebee
fi fi
done
else else
mkdir -pv "$dir" if [[ $xpath == *"$MNT"* ]]; then
for i in dwm dmenu st; do chrun "nvidia-installer" # unsure which card so try auto detection
if git clone "https://git.suckless.org/$i" "$dir/$i"; then
cd "$dir/$i" && make PREFIX=/usr install
else else
printf "failed to clone %s repo\n" "$i" nvidia-installer
fi fi
done
fi fi
if [[ -e $xpath/20-nvidia.conf ]]; then
echo "NVIDIA driver installed"
if [[ $xpath == *"$MNT"* ]]; then
echo "Trying to load the driver for live session"
nvidia-smi -r
fi
echo "To enable driver vsync:"
echo -e "\trun nvidia-settings (as root) on first boot\n\tenable 'ForceFullCompositionPipeline' under the advanced settings"
echo -e "\tlastly save the change to your nvida xorg config /etc/X11/xorg.conf.d/20-nvidia.conf"
echo -e "\tand remove everything but the Device and Screen sections from the file"
else
echo "Unable to install nvidia driver"
fi
return 0
fi
# remove nvidia installer from installed system when not running nvidia gpu
[[ $xpath == *"$MNT"* ]] && rm -rf "$MNT/usr/bin/nvidia-installer" "$MNT/var/lib/nvidia-installer"
} }
############################################################################### ###############################################################################
@ -1543,17 +1597,17 @@ lightdm_config()
ly_config() ly_config()
{ {
: : #TODO
} }
gdm_config() gdm_config()
{ {
: : #TODO
} }
sddm_config() sddm_config()
{ {
: : #TODO
} }
############################################################################### ###############################################################################
@ -2182,32 +2236,41 @@ live()
clear clear
die 0 die 0
elif ! net_connect; then elif ! net_connect; then
msg "Not Connected" "\nRunning live requires an active internet connection.\n\nExiting..\n" 2 msg "Not Connected" "\nRunning live requires an active internet connection to install packages.\n\nExiting..\n" 2
die 1 die 1
elif (( $(awk '/MemTotal/ {print int($2 / 1024)}' /proc/meminfo) < 2500)); then elif (( $(awk '/MemTotal/ {print int($2 / 1024)}' /proc/meminfo) < 2500)); then
msg "Not Enough Memory" "\nRunning live requires at least 2.5G of system memory.\n\nExiting..\n" 2 msg "Not Enough Memory" "\nLive session requires at least 2.5G of system memory for installing packages.\n\nExiting..\n" 2
die 1 die 1
else fi
clear clear
echo "Sorting mirrorlist first" echo "Sorting mirrorlist"
mount /run/archiso/cowspace -o remount,size=2G mount /run/archiso/cowspace -o remount,size=2G
install_mirrorlist "/etc/pacman.d/mirrorlist" install_mirrorlist "/etc/pacman.d/mirrorlist"
pacman -Syyu --noconfirm || die 1 pacman -Syyu --noconfirm || die 1
rm -rf "/var/cache/pacman/pkg/"*
pacman -S $BASE_PKGS $AL_BASE_PKGS xorg-xinit --needed --noconfirm || die 1 pacman -S $BASE_PKGS $AL_BASE_PKGS xorg-xinit --needed --noconfirm || die 1
rm -rf "/var/cache/pacman/pkg/"*
case "$ses" in case "$ses" in
i3-gaps|openbox|fluxbox|bspwm|awesome) pacman -S "$ses" $WM_BASE_PKGS ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;; i3-gaps|openbox|fluxbox|bspwm|awesome|xfce4) pacman -S "$ses" $WM_BASE_PKGS ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
gnome|plasma|cinnamon|xfce4) pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;; gnome|plasma|cinnamon) pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
dwm) { pacman -S git --needed --noconfirm || die 1; }; install_suckless "/root" nochroot ;; dwm) { pacman -S git --needed --noconfirm || die 1; }; install_suckless "/root" nochroot ;;
esac esac
pamixer --unmute rm -rf "/var/cache/pacman/pkg/"*
gtk-update-icon-cache /usr/share/icons/ArchLabs-Dark /usr/share/icons/ArchLabs-Light /usr/share/icons/ArchLabs [[ $VM ]] && dmesg | grep -qi 'vbox' && pacman -S virtualbox-guest-utils virtualbox-guest-modules-arch --needed --noconfirm
pacman -Scc --noconfirm pacman -Scc --noconfirm
rm -rf "/var/cache/pacman/pkg/"* rm -rf "/var/cache/pacman/pkg/"*
cp -rfT /etc/skel /root || die 1 cp -rfT /etc/skel /root
install_tearfree_conf "/etc/X11/xorg.conf.d"
case "$ses" in
plasma|gnome|cinnamon) sed -i '/super/d; /nitrogen/d; /compton/d' /root/.xprofile ;;
dwm) sed -i '/super/d; /compton/d' /root/.xprofile ;;
esac
rm -f /root/.zlogin
echo -e "pulseaudio &\n(sleep 1; pamixer --unmute --set-volume 50) &" >> /root/.xprofile
sed -i "/exec/ c exec ${WM_SESSIONS[$ses]}" /root/.xinitrc sed -i "/exec/ c exec ${WM_SESSIONS[$ses]}" /root/.xinitrc
printf "\n%s has been set as the login session in ~/.xinitrc, to start the session simply run\n\n\tstartx\n\n" "${WM_SESSIONS[$ses]}" printf "\n%s has been set as the login session in ~/.xinitrc, to start the session simply run\n\n\tstartx\n\n" "${WM_SESSIONS[$ses]}"
die 0 die 0
fi
} }
usage() usage()
@ -2238,6 +2301,12 @@ usage()
DIST='MyDistro' $1 DIST='MyDistro' $1
root/boot partition:
set the ROOT_PART and/or BOOT_PART environment variables before launching the installer eg.
ROOT_PART='/dev/sda2' BOOT_PART='/dev/sda1' $1
editor used: editor used:
set the EDITOR environment variable before launching the installer eg. set the EDITOR environment variable before launching the installer eg.
@ -2374,7 +2443,7 @@ net_connect()
nmtui-connect nmtui-connect
fi fi
chk_connect chk_connect
elif hash wifi-menu >dev/null 2>&1; then elif hash wifi-menu > /dev/null 2>&1; then
wifi-menu wifi-menu
chk_connect chk_connect
else else
@ -2423,7 +2492,7 @@ system_identify()
modprobe -q efivarfs > /dev/null 2>&1 modprobe -q efivarfs > /dev/null 2>&1
_prep="\nOnce a step is finished a step you will be returned here, if the step was successful the cursor will be advanced to the next step.\nIf a step is unsuccessful the cursor will be placed on the step required to advance (when possible).\n\nTo begin the install you should have:\n\n - A root (/) partition mounted." _prep="\nOnce a step is finished a step you will be returned here, if the step was successful the cursor will be advanced to the next step.\nIf a step is unsuccessful the cursor will be placed on the step required to advance (when possible).\n\nSteps beginning with an asterix (*) are required before continuing.\n\nTo begin the install you should have:\n\n - A root (/) partition mounted."
if [[ -d /sys/firmware/efi/efivars ]]; then if [[ -d /sys/firmware/efi/efivars ]]; then
export SYS="UEFI" export SYS="UEFI"
grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars
@ -2448,21 +2517,26 @@ if (( UID != 0 )); then
elif ! grep -qwm 1 'lm' /proc/cpuinfo; then elif ! grep -qwm 1 'lm' /proc/cpuinfo; then
msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2 msg "Not x86_64 Architecture" "\nThis installer only supports x86_64 architectures.\n\nExiting..\n" 2
die 1 die 1
else
case "$1" in
-d|--debug) debug ;;
-h|--help) usage "$0" ;;
-l|--live)
case "$2" in
gnome|cinnamon|dwm|plasma|xfce4|i3-gaps|openbox|fluxbox|bspwm|awesome) live "$2" ;;
*) echo "error: invalid session for -l, --live, see -h, --help"; die 1 ;;
esac ;;
esac
fi fi
# trap ^C to perform cleanup # trap ^C to perform cleanup
trap 'printf "\n^C\n" && die 1' INT trap 'printf "\n^C\n" && die 1' INT
while getopts ":hl:d" OPT; do
case "$OPT" in
d) debug ;;
h) usage "$0" ;;
l)
if [[ "${!WM_SESSIONS[@]}" =~ $OPTARG ]]; then
live "$OPTARG"
else
echo "error: invalid session for -l, see -h for help"; die 1
fi
;;
\?) echo "error: invalid option: -$OPTARG"; die 1 ;;
esac
done
system_identify system_identify
system_devices system_devices
@ -2474,8 +2548,6 @@ elif ! net_connect; then
msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2 msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2
die 1 die 1
fi fi
EXMNTS=""
FORMATTED=""
while :; do while :; do
main main