165f994bc1
* Drop deprecated device.config from AMD64. * Add a platform quirk for AMD64.x
27 lines
657 B
Bash
Executable file
27 lines
657 B
Bash
Executable file
#!/bin/sh
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
|
|
|
|
# Minimal OS variable loading for performance
|
|
. /etc/profile.d/001-functions
|
|
|
|
tocon "Setting root password..."
|
|
|
|
if [ ! -d "/storage/.cache/samba" ]
|
|
then
|
|
mkdir -p /storage/.cache/samba
|
|
touch /storage/.cache/samba/smbpasswd
|
|
fi
|
|
|
|
ROTATION=$(get_setting rotate.root.password)
|
|
if [ "${ROTATION}" == "0" ]
|
|
then
|
|
ROOTPASS=$(get_setting root.password)
|
|
setrootpass "${ROOTPASS}"
|
|
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}"
|