distribution/packages/jelos/autostart/001-setup
2023-10-23 22:53:27 +00:00

66 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023-present - The JELOS Project (https://github.com/JustEnoughLinuxOS) (https://github.com/fewtarius)
. /etc/profile
if [ -d "/storage/cache/.cores" ]
then
rm -rf /storage/cache/.cores
fi
if [ ! -d "/tmp/cache" ]
then
mkdir -p /tmp/cache
fi
ln -sf /tmp/cache /storage/cache/.cores
if [ ! -d "/storage/.config/profile.d" ]
then
mkdir -p /storage/.config/profile.d
fi
### Inspect the system config and revert
### to last known good state if corrupt.
/usr/bin/chksysconfig verify
### We do not want to mount the cloud drive on startup
### so we'll reset the mount option to 0.
set_setting clouddrive.mounted 0
### Enable the desired number of threads.
tocon "Restoring cpu threads..."
NUMTHREADS=$(get_setting "system.threads")
if [ -n "${NUMTHREADS}" ]
then
onlinethreads ${NUMTHREADS} 0
else
onlinethreads all 1
fi
### If we don't have a default governor set, set it
### to schedutil.
if [ -z "$(get_setting system.cpugovernor)" ]
then
set_setting system.cpugovernor schedutil
fi
### Set the default GPU performance mode
GPUPERF=$(get_setting system.gpuperf)
if [ -n "${GPUPERF}" ]
then
gpu_performance_level ${GPUPERF}
fi
### Configure suspend mode.
MYSLEEPMODE=$(get_setting system.suspendmode)
if [ -n "${MYSLEEPMODE}" ]
then
/usr/bin/suspendmode ${MYSLEEPMODE}
else
/usr/bin/suspendmode mem
fi
### Clean up settings
sort_settings