mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 13:16:35 +00:00
minor S21passwd init script reorganization
This commit is contained in:
parent
f542c6a71c
commit
b2c41dfcdc
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
test -x /etc/init.d/adminpw || exit 0
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
# make sure root and admin users exist in shadow file
|
# make sure root and admin users exist in shadow file
|
||||||
@ -16,22 +14,25 @@ case "$1" in
|
|||||||
echo 'admin::::::::' >> /data/etc/shadow
|
echo 'admin::::::::' >> /data/etc/shadow
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set root and admin passwords (admin is just an alias for root)
|
|
||||||
password=$(/etc/init.d/adminpw)
|
|
||||||
msg_begin "Setting root password"
|
|
||||||
|
|
||||||
# remove shadow backups
|
# remove shadow backups
|
||||||
rm -f /data/etc/shadow+
|
rm -f /data/etc/shadow+
|
||||||
rm -f /data/etc/shadow-
|
rm -f /data/etc/shadow-
|
||||||
|
|
||||||
echo -en "$password\n$password\n" | passwd &>/dev/null # root
|
if [ -x /etc/init.d/adminpw ]; then
|
||||||
echo -en "$password\n$password\n" | passwd admin &>/dev/null # admin
|
# set root and admin passwords (admin is just an alias for root)
|
||||||
|
password=$(/etc/init.d/adminpw)
|
||||||
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
|
msg_begin "Setting root password"
|
||||||
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
|
|
||||||
|
echo -en "$password\n$password\n" | passwd &>/dev/null # root
|
||||||
|
echo -en "$password\n$password\n" | passwd admin &>/dev/null # admin
|
||||||
|
|
||||||
|
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
|
||||||
|
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
|
||||||
|
msg_done
|
||||||
|
fi
|
||||||
|
|
||||||
sync
|
sync
|
||||||
|
|
||||||
msg_done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user