recipes: devel/elfutils: Build against cdefs.h header file
[dragora.git] / archive / dragora-installer / parts / SetPassword
blob46cdfcca900a33d7607a568206f93932c461682c
1 # This file is part of the 'dragora-installer'.
3 # Purpose: Set super-user (root) password.
5 # Make sure to have /dev available for passwd(1)
6 if ! mountpoint -q /media/dragora-root/dev
7 then
8     mount --bind /dev /media/dragora-root/dev
9 fi
11 while test "$(grep -m 1 "^root:" /media/dragora-root/etc/shadow | cut -f 2 -d :)" = x
13     _status=0
15     dialog --colors \
16      --backtitle "\\ZbSystem administrator password" \
17      --title "PASSWORD NOT DETECTED" \
18      --msgbox \
19 "No password has been detected for the system administrator\\n\
20 (root) account.\\n\\nIt is important to set it in order to \
21 have access to the entire system.  Please do it now!" 10 62 || _status=$?
22     if test $_status -eq 0
23     then
24         echo ""
25         chroot /media/dragora-root /usr/bin/passwd root
26         echo ""
27         echo " To continue, press [Enter]..."
28         IFS= read -r REPLY < /dev/tty || exit 2;
29         unset -v REPLY
30         continue;
31     elif test $_status -eq 255
32     then
33         dialog \
34          --title "System administrator password" \
35          --defaultno --yesno \
36 "\\nAre you sure you want to leave this without a password?\\n\
37 You will not have full access to the system." 8 59 || continue;
38     fi
39     break;
40 done
41 unset -v _status
43 # Refresh shadow files
44 chroot /media/dragora-root /usr/sbin/shadowconfig off > /dev/null 2>&1 || true
45 chroot /media/dragora-root /usr/sbin/shadowconfig on  > /dev/null 2>&1 || true
47 dialog --clear