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
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