From a37783f4726071f5aad4d38821b1541019b9bcb6 Mon Sep 17 00:00:00 2001 From: Dan Johansen Date: Thu, 21 Nov 2019 19:53:43 +0100 Subject: [PATCH] General code clean. Use openssl to generate passwords instead of mkpasswd. Change dependency in README from mkpasswd to openssL --- README.md | 2 +- manjaro-arm-installer | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 615a67d..b0187d4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This script is "interactive". Meaning that it asks you questions when run to cus * parted * libarchive * binfmt-qemu-static -* debian-whois-mkpasswd +* openssl * gawk ## Installing and using from gitlab: diff --git a/manjaro-arm-installer b/manjaro-arm-installer index 9463ba6..e002802 100755 --- a/manjaro-arm-installer +++ b/manjaro-arm-installer @@ -59,8 +59,8 @@ if [ ! -f /usr/bin/git ]; then elif [ ! -f /usr/bin/bsdtar ]; then echo "bsdtar command is missing! Please install libarchive!" exit 1 - elif [ ! -f /usr/bin/mkpasswd ]; then - echo "mkpasswd command is missing! Please install debian-whois-mkpasswd!" + elif [ ! -f /usr/bin/openssl ]; then + echo "openssl command is missing! Please install openssl!" exit 1 elif [ ! -f /usr/bin/awk ]; then echo "awk command is missing! Please install gawk!" @@ -167,10 +167,10 @@ create_install() { echo "$ROOTPASSWORD" > $TMPDIR/rootpassword info "Setting password for root ..." - $NSPAWN $TMPDIR/root awk -i inplace -F: "BEGIN {OFS=FS;} \$1 == \"root\" {\$2=\"$(mkpasswd --hash=SHA-512 $(cat $TMPDIR/rootpassword))\"} 1" /etc/shadow 1> /dev/null 2>&1 + $NSPAWN $TMPDIR/root awk -i inplace -F: "BEGIN {OFS=FS;} \$1 == \"root\" {\$2=\"$(openssl passwd -1 $(cat $TMPDIR/rootpassword))\"} 1" /etc/shadow 1> /dev/null 2>&1 info "Adding user..." - $NSPAWN $TMPDIR/root useradd -m -G wheel,sys,input,video,storage,lp,network,users,power -p $(mkpasswd --hash=SHA-512 $(cat $TMPDIR/password)) -s /bin/bash $(cat $TMPDIR/user) 1> /dev/null 2>&1 + $NSPAWN $TMPDIR/root useradd -m -G wheel,sys,input,video,storage,lp,network,users,power -p $(openssl passwd -1 $(cat $TMPDIR/password)) -s /bin/bash $(cat $TMPDIR/user) 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root usermod -aG $USERGROUPS $(cat $TMPDIR/user) 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root chfn -f "$FULLNAME" $(cat $TMPDIR/user) 1> /dev/null 2>&1 @@ -193,7 +193,6 @@ create_install() { echo "LANG=$LOCALE" | tee --append $TMPDIR/root/etc/locale.conf 1> /dev/null 2>&1 $NSPAWN $TMPDIR/root locale-gen echo "KEYMAP=$CLIKEYMAP" | tee --append $TMPDIR/root/etc/vconsole.conf 1> /dev/null 2>&1 - #$NSPAWN $TMPDIR/root localectl set-x11-keymap $KEYMAP 1> /dev/null 2>&1 echo 'Section "InputClass"' > $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf echo 'Identifier "system-keyboard"' >> $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf echo 'Option "XkbLayout" "us"' >> $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf