From 18aed562f8cbc9fe2a6b5fd95502d7e1c5119b29 Mon Sep 17 00:00:00 2001 From: TuDatTr Date: Sun, 24 May 2020 04:47:53 +0200 Subject: [PATCH] root/march-chroot:Added cryptroot and rootpart so that the vars can be used there --- root/march-chroot.sh | 28 +++++++++++++++++++--------- root/march-reboot.sh | 6 +++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/root/march-chroot.sh b/root/march-chroot.sh index e615ea2..f203f87 100644 --- a/root/march-chroot.sh +++ b/root/march-chroot.sh @@ -7,8 +7,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then exit 1 fi -OPTIONS=t:l:h:u:s: -LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp: +OPTIONS=t:l:h:u:s:r:c: +LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp:,rootpart:,cryptroot: ! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") if [[ ${PIPESTATUS[0]} -ne 0 ]]; then @@ -21,11 +21,13 @@ locale="CHANGEME" # specified in ./march-chroot.sh hostname="CHANGEME" # specified in ./march-chroot.sh username="CHANGEME" # specified in ./march-chroot.sh sudogrp="CHANGEME" # specified in ./march-chroot.sh +rootpart="CHANGEME" # specified in ./march-chroot.sh +cryptroot="CHANGEME" # specified in ./march-chroot.sh CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" while true; do - case "$!" in + case "$1" in -t|--timezone) timezone="$2" shift 2 @@ -61,6 +63,14 @@ Mandatory arguments: " exit 0 ;; + -r|--rootpart) + rootpart="$2" + shift 2 + ;; + -c|--cryptroot) + cryptroot="$2" + shift 2 + ;; --) shift break @@ -73,12 +83,12 @@ Mandatory arguments: done -ln -sf $timezone /etc/localtime +ln -sf "$timezone" /etc/localtime hwclock --systohc -echo $locale >> /etc/locale.gen -if [ $locale != "en_US.UTF-8 UTF-8"]; then +echo "$locale" >> /etc/locale.gen +if [ "$locale" != "en_US.UTF-8 UTF-8" ]; then echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen fi @@ -86,7 +96,7 @@ locale-gen echo "LANG=en_US.UTF-8" > /etc/locale.conf -echo $hostname > /etc/hostname +echo "$hostname" > /etc/hostname sed -i "s/^HOOKS=([[:alnum:][:space:]]\+)/HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)/" /etc/mkinitcpio.conf mkinitcpio -p linux @@ -95,13 +105,13 @@ passwd bootctl install echo "timeout 3 -default arch" > /boot/loader/loader.conf +default arch" >| /boot/loader/loader.conf echo "title ArchLinux linux /vmlinuz-linux initrd /initramfs-linux.img options rw cryptdevice=$(blkid $rootpart | cut -d" " -f2 | tr -d \"):cryptroot root=$cryptroot i8042.noloop i8042.nomux i8042.nopnp i8042.reset" > /boot/loader/entries/arch.conf -sed -i "s/march-reboot.sh/\0 -u $u-s $s/" /etc/systemd/system/march.service +sed -i "s/march-reboot.sh/\0 -u $username -s $sudogrp/" /etc/systemd/system/march.service systemctl enable march.service systemctl enable dhcpcd.service diff --git a/root/march-reboot.sh b/root/march-reboot.sh index 7561276..5a3a928 100644 --- a/root/march-reboot.sh +++ b/root/march-reboot.sh @@ -22,7 +22,7 @@ sudogrp="CHANGEME" CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" while true; do - case "$!" in + case "$1" in -t|--timezone) timezone="$2" shift 2 @@ -57,8 +57,8 @@ while true; do pacman -S --noconfirm git zsh gvim wget arch-audit lightdm lightdm-webkit2-greeter xorg-server xf86-video-intel i3-gaps xorg-xbacklight xorg-xrandr i3lock-color alsa-utils pulseaudio pulseaudio-alsa pulseaudio-bluetooth playerctl pavucontrol exfat-utils udiskie blueman acpi acpid tlp compton conky rxvt-unicode networkmanager network-manager-applet networkmanager-openconnect networkmanager-openvpn stow maim openssh xdotool xclip thunderbird firefox veracrypt keepassxc texlive-most evince pandoc pdfgrep adobe-source-han-sans-otc-fonts python3 python3-pip ranger atool elinks ffmpegthumbnailer highlight libcaca lynx mediainfo odt2txt perl-image-exiftool poppler python-chardet transmission-cli w3m echo "%$sudogrp ALL=(ALL) ALL" >> /etc/sudoers -groupadd $sudogrp -useradd -m -G $sudogrp -s $username +groupadd "$sudogrp" +useradd -m -G "$sudogrp" -s "$username" systemctl enable lightdm sed -i "s/#user-session.*/user-session=i3/g" /etc/lightdm/lightdm.conf