root/march-chroot:Added cryptroot and rootpart so that the vars can be used there

This commit is contained in:
TuDatTr
2020-05-24 04:47:53 +02:00
parent 728f25857e
commit 18aed562f8
2 changed files with 22 additions and 12 deletions

View File

@@ -7,8 +7,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
exit 1 exit 1
fi fi
OPTIONS=t:l:h:u:s: OPTIONS=t:l:h:u:s:r:c:
LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp: LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp:,rootpart:,cryptroot:
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") ! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
@@ -21,11 +21,13 @@ locale="CHANGEME" # specified in ./march-chroot.sh
hostname="CHANGEME" # specified in ./march-chroot.sh hostname="CHANGEME" # specified in ./march-chroot.sh
username="CHANGEME" # specified in ./march-chroot.sh username="CHANGEME" # specified in ./march-chroot.sh
sudogrp="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 )" CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
while true; do while true; do
case "$!" in case "$1" in
-t|--timezone) -t|--timezone)
timezone="$2" timezone="$2"
shift 2 shift 2
@@ -61,6 +63,14 @@ Mandatory arguments:
" "
exit 0 exit 0
;; ;;
-r|--rootpart)
rootpart="$2"
shift 2
;;
-c|--cryptroot)
cryptroot="$2"
shift 2
;;
--) --)
shift shift
break break
@@ -73,12 +83,12 @@ Mandatory arguments:
done done
ln -sf $timezone /etc/localtime ln -sf "$timezone" /etc/localtime
hwclock --systohc hwclock --systohc
echo $locale >> /etc/locale.gen echo "$locale" >> /etc/locale.gen
if [ $locale != "en_US.UTF-8 UTF-8"]; then if [ "$locale" != "en_US.UTF-8 UTF-8" ]; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
fi fi
@@ -86,7 +96,7 @@ locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf 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 sed -i "s/^HOOKS=([[:alnum:][:space:]]\+)/HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)/" /etc/mkinitcpio.conf
mkinitcpio -p linux mkinitcpio -p linux
@@ -95,13 +105,13 @@ passwd
bootctl install bootctl install
echo "timeout 3 echo "timeout 3
default arch" > /boot/loader/loader.conf default arch" >| /boot/loader/loader.conf
echo "title ArchLinux echo "title ArchLinux
linux /vmlinuz-linux linux /vmlinuz-linux
initrd /initramfs-linux.img 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 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 march.service
systemctl enable dhcpcd.service systemctl enable dhcpcd.service

View File

@@ -22,7 +22,7 @@ sudogrp="CHANGEME"
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
while true; do while true; do
case "$!" in case "$1" in
-t|--timezone) -t|--timezone)
timezone="$2" timezone="$2"
shift 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 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 echo "%$sudogrp ALL=(ALL) ALL" >> /etc/sudoers
groupadd $sudogrp groupadd "$sudogrp"
useradd -m -G $sudogrp -s $username useradd -m -G "$sudogrp" -s "$username"
systemctl enable lightdm systemctl enable lightdm
sed -i "s/#user-session.*/user-session=i3/g" /etc/lightdm/lightdm.conf sed -i "s/#user-session.*/user-session=i3/g" /etc/lightdm/lightdm.conf