mirror of
https://github.com/unraid/webgui.git
synced 2026-05-24 07:09:42 -05:00
feat: safe mode go script handling
This commit is contained in:
@@ -497,12 +497,20 @@ if (glob("/boot/config/*.conf")) {
|
||||
if (glob("/boot/config/*.dat")) {
|
||||
run("cp -- /boot/config/*.dat ".escapeshellarg("/$diag/config"));
|
||||
}
|
||||
run("cp /boot/config/go ".escapeshellarg("/$diag/config/go.txt"));
|
||||
|
||||
// anonymize go file
|
||||
if (!$all) {
|
||||
run("sed -i -e '/password/c ***line removed***' -e '/user/c ***line removed***' -e '/pass/c ***line removed***' ".escapeshellarg("/$diag/config/go.txt"));
|
||||
// handle go files
|
||||
foreach (['/boot/config/go', '/boot/config/go.safemode'] as $go) {
|
||||
if (file_exists($go)) {
|
||||
$dest = "/$diag/config/" . basename($go) . ".txt";
|
||||
run("cp " . escapeshellarg($go) . " " . escapeshellarg($dest));
|
||||
|
||||
// anonymize go file
|
||||
if (!$all) {
|
||||
run("sed -i -e '/password/c ***line removed***' -e '/user/c ***line removed***' -e '/pass/c ***line removed***' " . escapeshellarg($dest));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// anonymize configuration files
|
||||
if (!$all) {
|
||||
run("find ".escapeshellarg("/$diag/config")." -name '*.cfg' -exec sed -ri 's/^((disk|flash)(Read|Write)List.*=\")[^\"]+/\\1.../' {} \\;");
|
||||
|
||||
+13
-5
@@ -243,9 +243,17 @@ if grep -q "$GOTEST2" $CONFIG/go; then
|
||||
fi
|
||||
|
||||
# Invoke the 'go' script
|
||||
if [[ -f $CONFIG/go ]]; then
|
||||
log "Starting go script"
|
||||
fromdos <$CONFIG/go >/var/tmp/go
|
||||
chmod +x /var/tmp/go
|
||||
/var/tmp/go
|
||||
GO=go
|
||||
if [[ -f /boot/unraidsafemode ]] || grep -wq unraidsafemode /proc/cmdline; then
|
||||
GO=go.safemode
|
||||
fi
|
||||
if [[ -f $CONFIG/$GO ]]; then
|
||||
log "Starting $GO script"
|
||||
fromdos <$CONFIG/$GO >/var/tmp/$GO
|
||||
chmod +x /var/tmp/$GO
|
||||
/var/tmp/$GO
|
||||
fi
|
||||
if [[ ! -f /var/run/emhttpd.socket ]]; then
|
||||
log "Starting emhttp"
|
||||
/usr/local/sbin/emhttp
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user