Added password for user

This commit is contained in:
TuDatTr
2020-05-24 09:02:28 +02:00
parent 03c79d8463
commit c42b0af8fe
3 changed files with 24 additions and 21 deletions

View File

@@ -7,8 +7,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
exit 1
fi
OPTIONS=t:l:h:u:s:r:c:
LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp:,rootpart:,cryptroot:
OPTIONS=t:l:h:u:s:r:c:p:
LONGOPTS=timezone:,locale:,hostname:,username:,sudogrp:,rootpart:,cryptroot:,password:
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
@@ -23,11 +23,16 @@ 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
password="CHANGEME" # specified in ./march-chroot.sh
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
while true; do
case "$1" in
-p|--password)
password="$2"
shift 2
;;
-t|--timezone)
timezone="$2"
shift 2
@@ -50,7 +55,7 @@ while true; do
;;
--help)
echo "
Usage: ./install.sh -d [DEVICE] -t [/usr/share/zoneinfo/REGION/CITY] -l [LOCALE] -h [HOSTNAME] -u [USER] -s [SUDO]
Usage: ./install.sh -d [DEVICE] -t [/usr/share/zoneinfo/REGION/CITY] -l [LOCALE] -h [HOSTNAME] -u [USER] -s [SUDO]
A small script to automate my archlinux configuration.
Mandatory arguments:
@@ -111,7 +116,7 @@ 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 \"$username\" -s \"$sudogrp\"/" /etc/systemd/system/march.service
sed -i "s/march-reboot.sh/\0 -u \"$username\" -s \"$sudogrp\" -p \"$password\"/" /etc/systemd/system/march.service
systemctl enable march.service
systemctl enable NetworkManager.service