distribution/packages/jelos/autostart/007-rootpw

28 lines
650 B
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2022-02-05 14:23:32 +00:00
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
2022-02-05 14:23:32 +00:00
tocon "Setting root password..."
if [ ! -d "/storage/.cache/samba" ]
then
mkdir -p /storage/.cache/samba
touch /storage/.cache/samba/smbpasswd
fi
2022-02-05 14:23:32 +00:00
ROTATION=$(get_setting rotate.root.password)
if [ "${ROTATION}" == "0" ]
then
ROOTPASS=$(get_setting root.password)
setrootpass "${ROOTPASS}"
2022-02-05 14:23:32 +00:00
exit 0
fi
# Randomly generate the root password on startup
ROOTPASS=$(openssl rand -base64 10 2>/dev/null | sed "s#==##g")
/usr/bin/setrootpass "${ROOTPASS}"