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=u:s:
LONGOPTS=username:,sudogrp:
OPTIONS=u:s:p:
LONGOPTS=username:,sudogrp:,password:
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
@@ -17,28 +17,21 @@ fi
eval set -- "$PARSED"
username="CHANGEME"
password="CHANGEME"
sudogrp="CHANGEME"
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
while true; do
case "$1" in
-t|--timezone)
timezone="$2"
shift 2
;;
-l|--locale)
locale="$2"
shift 2
;;
-h|--hostname)
hostname="$2"
shift 2
;;
-u|--username)
username="$2"
shift 2
;;
-p|--password)
password="$2"
shift 2
;;
-s|--sudogrp)
sudogrp="$2"
shift 2
@@ -61,6 +54,7 @@ pacman -S --noconfirm git zsh gvim wget arch-audit lightdm lightdm-webkit2-greet
echo "%$sudogrp ALL=(ALL) ALL" >> /etc/sudoers
groupadd "$sudogrp"
useradd -m -G "$sudogrp" -s /bin/zsh "$username"
echo "$username:$password" | chpasswd
systemctl enable lightdm
sed -i "s/#user-session.*/user-session=i3/g" /etc/lightdm/lightdm.conf