Fix xinit session issue

This commit is contained in:
natemaia 2018-08-28 23:30:40 -07:00
parent b3657b0c9d
commit a48143063a
4 changed files with 62 additions and 37 deletions

View File

@ -12,7 +12,7 @@
# immutable variables {
readonly DIST="ArchLabs" # Linux distributor
readonly VER="1.6.62" # Installer version
readonly VER="1.6.64" # Installer version
readonly LIVE="liveuser" # Live session user
readonly MNT="/mnt/install" # Install mountpoint
readonly ERR="/tmp/errlog" # Built-in error log
@ -26,10 +26,22 @@ readonly LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if($1) print $1 " -"}' /
readonly CONSOLE_MAPS="$(awk '{gsub(/\.map\.gz|.*\//, ""); print $1 " -"}' <<< "$KBD")"
readonly SYS_MEM=$(grep 'MemTotal' /proc/meminfo | awk '{print int($2 / 1024)}')
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
readonly IGNORE_DEV="$(lsblk -lno NAME,MOUNTPOINT | awk '/\/run\/archiso\/bootmnt/ {sub(/[1-9]/, ""); print $1}')"
if [[ $IGNORE_DEV ]]; then
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ && !'"/$IGNORE_DEV/"' {print "/dev/" $1 " " $2}')"
else
readonly SYS_DEVS="$(lsblk -lno NAME,SIZE,TYPE | awk '/disk/ {print "/dev/" $1 " " $2}')"
fi
readonly DEV_COUNT="$(wc -l <<< "$SYS_DEVS")"
if [[ $(grep 'GenuineIntel' /proc/cpuinfo) ]]; then
readonly UCODE="/intel-ucode.img"
elif [[ $(grep 'AuthenticAMD' /proc/cpuinfo) ]]; then
readonly UCODE="/amd-ucode.img"
fi
# create associative array for SUBZONES[zone], value is: 'sub-zone country_code'
declare -Ag SUBZONES
for zone in America Australia Asia Atlantic Africa Europe Indian Pacific Arctic Antarctica; do
@ -295,6 +307,16 @@ window_manager() {
WM_PACKAGES="$WM_PACKAGES archlabs-oblogout archlabs-screenlock"
fi
# choose which to login
if [[ $WM_NUM -eq 1 ]]; then
LOGIN_WM="$INSTALL_WMS"
else
LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"
[[ $LOGIN_WM == "" ]] && LOGIN_WM="$(awk '{print $1}' <<< "$INSTALL_WMS")"
fi
# chose login type
if yesno "$_WMLogin" "$_LoginTypeBody\n" "xinit" "lightdm"; then
LOGIN_TYPE='xinit'
FILES[11]="/home/$NEWUSER/.xinitrc"
@ -306,16 +328,9 @@ window_manager() {
EXTRA_PACKAGES="$WM_PACKAGES"
# autologin
yesno "$_WMLogin" "$_AutoLoginBody\n" && AUTOLOGIN=true || AUTOLOGIN=false
if [[ $WM_NUM -eq 1 ]]; then
LOGIN_WM="$INSTALL_WMS"
else
LOGIN_WM="$(dialog --cr-wrap --stdout --no-cancel --backtitle "$BT" \
--title " $_WMLogin " --menu "$_WMLoginBody" 0 0 0 $LOGIN_CHOICES)"
[[ $LOGIN_WM == "" ]] && LOGIN_WM="$(awk '{print $1}' <<< "$INSTALL_WMS")"
fi
case $LOGIN_WM in
i3-gaps) LOGIN_WM='i3' ;;
gnome) LOGIN_WM='gnome-session' ;;

View File

@ -75,7 +75,6 @@ uefi_boot_fallback() {
}
prep_for_grub() {
local ucode="$1"
local cfg="$MNT/etc/default/grub"
if [[ $SYS == 'UEFI' ]]; then
@ -191,8 +190,13 @@ install_bootloader() {
fi
# needed for os-prober module to work properly in the chroot
mkdir -p $MNT/run/udev && mount --bind /run/udev $MNT/run/udev
BCMDS[$BOOTLDR]="mkdir -p /run/udev && mount --bind /run/udev /run/udev ; ${BCMDS[$BOOTLDR]}"
mkdir -p $MNT/{dev,sys,proc,run/udev}
mount remount,rw -t proc proc $MNT/proc
mount remount,rw -t sysfs sys $MNT/sys
mount --bind /dev $MNT/dev
mount remount,rw -t tmpfs tmpfs $MNT/run
mount --bind /run/udev $MNT/run/udev
# BCMDS[$BOOTLDR]="mkdir -p /run/udev && mount --bind /run/udev /run/udev ; ${BCMDS[$BOOTLDR]}"
if [[ $SYS == 'UEFI' ]]; then
# make sure efivarfs has been mounted
@ -207,14 +211,8 @@ install_bootloader() {
-type d -exec rm -rf '{}' \; >/dev/null 2>&1
fi
local ucode=""
if [[ $(grep 'GenuineIntel' /proc/cpuinfo) && -e $MNT/boot/intel-ucode.img ]]; then
ucode="/intel-ucode.img"
elif [[ $(grep 'AuthenticAMD' /proc/cpuinfo) && -e $MNT/boot/amd-ucode.img ]]; then
ucode="/amd-ucode.img"
fi
# sets up the bootloader config(s) and ${BCMDS[$BOOTLDR]}
prep_for_$BOOTLDR "$ucode"
prep_for_$BOOTLDR "$UCODE"
# run the bootloader command
chroot_cmd "${BCMDS[$BOOTLDR]}"

View File

@ -38,7 +38,7 @@ install_main() {
install_base() {
clear
tput cnorm
echo -e "\nUnpacking base filesystem --- Total: ~2.8G\n\n"
echo -e "\nUnpacking base file system --- Total: ~ 2.8G\n\n"
rsync -ah --info=progress2 /run/archiso/sfs/airootfs/ $MNT/
# remove archiso init files and clean up install files
@ -52,13 +52,31 @@ install_base() {
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
# for virtual machines remove configs for xorg, these cause mouse issues
[[ $VM ]] && rm -rf $MNT/etc/X11/xorg.conf.d
if [[ $VM ]]; then
rm -rf $MNT/etc/X11/xorg.conf.d
elif [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then
# setup xorg vsync config for intel graphics
cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
EOF
fi
# if not installing the lts kernel, copy the kernel image
if [[ $KERNEL != 'linux-lts' ]]; then
cp -f /run/archiso/bootmnt/arch/boot/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
fi
# CPU micro-code
if [[ $UCODE == "/intel-ucode.img" ]]; then
cp -f /run/archiso/bootmnt/arch/boot/intel_ucode.img $MNT/boot/intel_ucode.img
else
cp -f /run/archiso/bootmnt/arch/boot/amd_ucode.img $MNT/boot/amd_ucode.img
fi
setup_configs
return 0
}
@ -75,17 +93,6 @@ setup_configs() {
chroot_cmd "locale-gen" 2>/dev/null
chroot_cmd "ln -sf /usr/share/zoneinfo/$ZONE/$SUBZONE /etc/localtime" 2>/dev/null
# setup xorg vsync config for intel graphics
if [[ $(lspci | grep ' VGA ' | grep 'Intel') != "" ]]; then
cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<EOF
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
EOF
fi
# set the keymaps
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<EOF
# Use localectl(1) to instruct systemd-localed to update it.
@ -142,7 +149,7 @@ create_user() {
if [[ $AUTOLOGIN == true ]]; then
sed -i "s/${LIVE}/${NEWUSER}/g" $serve/autologin.conf
fi
sed -i "s/:-openbox/:-${LOGIN_WM}/g" $_home/.xinitrc
sed -i "s/openbox-session/${LOGIN_WM}/g" $_home/.xinitrc
sed -i '/archlabs-installer/d' $_home/.zprofile
cat >> $_home/.zprofile << EOF
[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && exec startx -- vt1 &>/dev/null
@ -250,7 +257,7 @@ setup_lightdm() {
sed -i '/#background=/ c background=/usr/share/backgrounds/archlabs/archlabs.jpg' $cfg
sed -i '/#theme-name=/ c theme-name=ArchLabs-dARK' $cfg
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Light' $cfg
sed -i '/#icon-theme-name=/ c icon-theme-name=ArchLabs-Dark' $cfg
sed -i '/#position=/ c position=34%,end 66%,end' $cfg
sed -i '/#font-name=/ c font-name=DejaVu Sans Mono 11' $cfg
sed -i '/\[greeter]/ a default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png' $cfg

View File

@ -233,10 +233,15 @@ show_devices() {
}
select_device() {
local dev
local msg
[[ $1 == 'boot' ]] && msg="$_DevSelTitle for bootloader\n" || unmount_partitions
if [[ $1 == 'boot' ]]; then
msg="$_DevSelTitle for bootloader\n"
else
unmount_partitions
fi
if (( DEV_COUNT == 1 )); then
if (( DEV_COUNT == 1 )) && [[ $SYS_DEVS ]]; then
DEVICE="$(awk '{print $1}' <<< "$SYS_DEVS")"
msg="\nOnly one device available$([[ $1 == 'boot' ]] && echo -n " for grub bootloader"):"
infobox "$_DevSelTitle" "$msg $DEVICE\n" 1