mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
(greeter): Revise dir perms and add validations
This commit is contained in:
@@ -1490,6 +1490,19 @@ func checkGreeterStatus() error {
|
|||||||
}
|
}
|
||||||
if stat, err := os.Stat(cacheDir); err == nil && stat.IsDir() {
|
if stat, err := os.Stat(cacheDir); err == nil && stat.IsDir() {
|
||||||
fmt.Printf(" ✓ %s exists\n", cacheDir)
|
fmt.Printf(" ✓ %s exists\n", cacheDir)
|
||||||
|
requiredSubdirs := []string{".local/state", ".local/share", ".cache"}
|
||||||
|
missingSubdirs := false
|
||||||
|
for _, sub := range requiredSubdirs {
|
||||||
|
subPath := filepath.Join(cacheDir, sub)
|
||||||
|
if _, err := os.Stat(subPath); os.IsNotExist(err) {
|
||||||
|
fmt.Printf(" ⚠ Missing required subdir: %s\n", subPath)
|
||||||
|
missingSubdirs = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if missingSubdirs {
|
||||||
|
fmt.Println(" Run 'dms greeter sync' to initialize the cache directory structure.")
|
||||||
|
allGood = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" ✗ %s not found\n", cacheDir)
|
fmt.Printf(" ✗ %s not found\n", cacheDir)
|
||||||
fmt.Printf(" %s\n", packageInstallHint())
|
fmt.Printf(" %s\n", packageInstallHint())
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ Singleton {
|
|||||||
property bool nightModeEnabled: false
|
property bool nightModeEnabled: false
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Quickshell.execDetached(["mkdir", "-p", greetCfgDir]);
|
|
||||||
loadMemory();
|
loadMemory();
|
||||||
loadSessionConfig();
|
loadSessionConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,8 +87,7 @@ exec_compositor() {
|
|||||||
exec "$@" > >(systemd-cat -t "dms-greeter/$log_tag" -p info) 2>&1
|
exec "$@" > >(systemd-cat -t "dms-greeter/$log_tag" -p info) 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local log_file="$CACHE_DIR/$log_tag.log"
|
exec "$@"
|
||||||
exec "$@" >> "$log_file" 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@@ -180,19 +179,10 @@ export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
|
|||||||
export EGL_PLATFORM=gbm
|
export EGL_PLATFORM=gbm
|
||||||
export DMS_RUN_GREETER=1
|
export DMS_RUN_GREETER=1
|
||||||
|
|
||||||
ensure_cache_tree() {
|
if [[ ! -d "$CACHE_DIR" ]]; then
|
||||||
local base="$1"
|
echo "Error: cache directory '$CACHE_DIR' does not exist." >&2
|
||||||
mkdir -p "$base/.local/state" "$base/.local/state/wireplumber" "$base/.local/share" "$base/.cache"
|
echo " Run 'dms greeter sync' to initialize it, or pass --cache-dir to an existing directory." >&2
|
||||||
}
|
exit 1
|
||||||
|
|
||||||
if ! ensure_cache_tree "$CACHE_DIR" 2>/dev/null; then
|
|
||||||
FALLBACK_CACHE_DIR="/tmp/dms-greeter-${UID:-$(id -u)}"
|
|
||||||
echo "Warning: cache directory '$CACHE_DIR' is not writable; falling back to '$FALLBACK_CACHE_DIR'" >&2
|
|
||||||
CACHE_DIR="$FALLBACK_CACHE_DIR"
|
|
||||||
if ! ensure_cache_tree "$CACHE_DIR"; then
|
|
||||||
echo "Error: failed to initialize fallback cache directory '$CACHE_DIR'" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DMS_GREET_CFG_DIR="$CACHE_DIR"
|
export DMS_GREET_CFG_DIR="$CACHE_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user