forked from RetroGFX/UnofficialOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-update
155 lines (132 loc) · 4.77 KB
/
post-update
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
LOG="/var/log/boot.log"
### This script contains items that we only want to execute after a JELOS upgrade,
### or after a fresh installation.
echo "Rebuild library cache..." >>${LOG}
### Rebuild the library cache
rm -f /storage/.cache/ld.so.cache
ldconfig -X
echo "Sync configuration files..." >>${LOG}
### Sync configurations
if [ -d "/storage/.config/system/configs" ]
then
EXCLUDE="--exclude=configs"
fi
rsync -a --delete ${EXCLUDE} /usr/config/system/ /storage/.config/system/
rsync -a --ignore-existing /usr/config/game /storage/.config/
rsync -a /usr/config/modules /storage/.config/
echo "Update logo..." >>${LOG}
if [ ! -L "/storage/.config/emulationstation/resources/logo.png" ]
then
rm -f /storage/.config/emulationstation/resources/logo.png ||:
ln -sf /usr/config/splash/splash.png /storage/.config/emulationstation/resources/logo.png
fi
echo "Sync modules..." >>${LOG}
rsync -a /usr/config/modules/* /storage/.config/modules/
cp -f /usr/config/retroarch/retroarch-core-options.cfg /storage/.config/retroarch/retroarch-core-options.cfg
echo "Sync theme..." >>${LOG}
cd /usr/share/themes
for theme in *
do
if [ ! -L /storage/.config/emulationstation/themes/${theme} ] && \
[ ! -e /storage/.config/emulationstation/themes/${theme} ]
then
ln -s /usr/share/themes/${theme} /storage/.config/emulationstation/themes
fi
done
cd -
### Apply developer ssh keys if they exist
echo "Apply dev keys if available..." >>${LOG}
if [ -e /usr/config/ssh/authorized_keys ]
then
cp /usr/config/ssh/authorized_keys /storage/.ssh
fi
### Sync rsync configs
echo "Update rsync configuration files..." >>${LOG}
rsync --ignore-existing /usr/config/rsync-rules.conf /storage/.config/
rsync --ignore-existing /usr/config/rsync.conf /storage/.config/
### Replace es_systems and es_features with links to manage them
echo "Sync ES configuration files..." >>${LOG}
for es_cfg in es_features.cfg es_systems.cfg
do
if [ -e "/storage/.config/emulationstation/${es_cfg}" ]
then
mv -f /storage/.config/emulationstation/${es_cfg} /storage/.config/emulationstation/last_${es_cfg}
fi
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg}
done
# Default modules need to be updated to use the new stop/start ui function.
echo "Sync modules (tools)..." >>${LOG}
rsync -av /usr/config/modules/* /storage/.config/modules/
# Swap es_input back to a writeable file so external controller configuration works properly.
echo "Make sure es_input isn't a link..." >>${LOG}
if [ -L "/storage/.config/emulationstation/es_input.cfg" ]
then
rm -f /storage/.config/emulationstation/es_input.cfg
cp -f /usr/config/emulationstation/es_input.cfg /storage/.config/emulationstation/es_input.cfg
fi
# Disable integer scaling by default on Win600
if [[ "${HW_DEVICE}" =~ handheld ]]
then
echo "No integer scaling (Win600 only)..." >>${LOG}
sed -i "s#.integerscale=1#.integerscale=0#g" /storage/.config/system/configs/system.cfg
fi
# We don't want to use gl on the 552, switch it to glcore.
if [[ "${HW_DEVICE}" =~ RG552 ]]
then
echo "Switch to glcore (RG552 only)..." >>${LOG}
sed -i 's#video_driver = "gl"#video_driver = "glcore"#g' /storage/.config/retroarch/retroarch.cfg
fi
# If smb.conf doesn't exist in ~/.config, add it.
if [ ! -e "/storage/.config/smb.conf" ]
then
echo "Make sure smb.conf is in .config..." >>${LOG}
cp -f /usr/config/smb.conf /storage/.config
fi
# Set GPU power saving by default
GPUPOWER=$(get_setting gpu.powersave)
if [ -z "${GPUPOWER}" ]
then
echo "Set up GPU power saving..." >>${LOG}
set_setting gpu.powersave 0
fi
# Set automatic hotkey management by default.
AUTOHOTKEYS=$(get_setting system.autohotkeys)
if [ -z "${AUTOHOTKEYS}" ]
then
echo "Set up hotkey management..." >>${LOG}
set_setting system.autohotkeys 1
fi
# Swap to schedutil as the default governor
GOVERNOR=$(get_setting system.cpugovernor)
if [ "${GOVERNOR}" = "interactive" ]
then
set_setting system.cpugovernor schedutil
schedutil
fi
# Set the default weston startup to ES
WESTONSTARTUP=$(get_setting weston.startup)
if [ -z "${WESTONSTARTUP}" ]
then
echo "Make sure weston is our default." >>${LOG}
set_setting weston.startup "/usr/bin/start_es.sh"
fi
# Fixing asound.state on RG552 with broken values
if [ "${HW_DEVICE}" == "RG552" ] && \
[ "$(grep -i 'value.*Invert' /storage/.config/asound.state)" ]
then
echo "Fix asound.state." >>${LOG}
cp /usr/config/asound.state /storage/.config/asound.state
fi
# Disable PCSX2SA auto update check
if [ -e "/storage/.config/PCSX2/inis/PCSX2.ini" ] && \
[ ! "$(grep -i AutoUpdater /storage/.config/PCSX2/inis/PCSX2.ini)" ]
then
cat <<EOF >>/storage/.config/PCSX2/inis/PCSX2.ini
[AutoUpdater]
CheckAtStartup = false
EOF
fi