/
retronas_password.sh
54 lines (50 loc) · 1.03 KB
/
retronas_password.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
clear
source /opt/retronas/dialog/retronas.cfg
cd ${DIDIR}
rn_retronas_password() {
source /opt/retronas/dialog/retronas.cfg
dialog \
--backtitle "RetroNAS" \
--title "RetroNAS Password Configuration" \
--clear \
--defaultno \
--yesno \
"Configure the RetroNAS password. \
\n
\nThe current RetroNAS user is \"${OLDRNUSER}\" \
\n
\nIf you are having problems with CIFS/SMB shares, you can reset their password here.
\n
\nProceed?" ${MG}
}
rn_retronas_password
CHOICE="$?"
case ${CHOICE} in
0)
# Yes, change the password
clear
echo
echo
echo "Changing the system password for ${OLDRNUSER} :"
echo
passwd ${OLDRNUSER}
echo
if [ -f "/usr/lib/systemd/system/smbd.service" ]
then
echo "Samba detected. Changing the Samba/SMB/CIFS password for user ${OLDRNUSER} :"
echo
smbpasswd -a ${OLDRNUSER}
echo
systemctl restart avahi-daemon smbd nmbd
echo
fi
echo "${PAUSEMSG}"
read -s
exit 0
;;
*)
# No, exit
exit ${CHOICE}
;;
esac