fix: atomic write on existing prefs path; Inkscape 1.x export flags; version check guard
This commit is contained in:
parent
41ffaf0268
commit
e41f315b98
2 changed files with 9 additions and 5 deletions
12
install.sh
12
install.sh
|
|
@ -33,7 +33,8 @@ check_deps() {
|
|||
version=$(inkscape --version 2>/dev/null | grep -oP '\d+\.\d+' | head -1)
|
||||
local major minor
|
||||
IFS='.' read -r major minor <<< "$version"
|
||||
if (( major < 1 )) || (( major == 1 && minor < 2 )); then
|
||||
# Skip version check if regex couldn't match (non-standard version string)
|
||||
if [[ -n "$major" ]] && { (( major < 1 )) || (( major == 1 && minor < 2 )); }; then
|
||||
echo "⚠ Inkscape $version detected. Illuscape targets Inkscape 1.2+."
|
||||
echo " Some settings may not apply correctly. Continue anyway? [y/N]"
|
||||
[[ $AUTO_YES == 1 ]] || { read -r ans; [[ "$ans" =~ ^[Yy]$ ]] || exit 0; }
|
||||
|
|
@ -56,7 +57,7 @@ backup_config() {
|
|||
local backup_dir="${INKSCAPE_CONFIG}.bak-illuscape-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
# If any illuscape backup already exists, skip (idempotent)
|
||||
if ls "${INKSCAPE_CONFIG}".bak-illuscape-* &>/dev/null 2>&1; then
|
||||
if ls "${INKSCAPE_CONFIG}".bak-illuscape-* &>/dev/null; then
|
||||
echo "→ Backup already exists — skipping (idempotent)"
|
||||
return 0
|
||||
fi
|
||||
|
|
@ -139,8 +140,11 @@ install_desktop() {
|
|||
-o "$icon_dir/illuscape.png" 2>/dev/null && continue
|
||||
fi
|
||||
if command -v inkscape &>/dev/null; then
|
||||
inkscape "$icon_src" --export-png="$icon_dir/illuscape.png" \
|
||||
--export-width="$size" --export-height="$size" 2>/dev/null && continue
|
||||
# Inkscape 1.x uses --export-filename + --export-type (--export-png removed in 1.0)
|
||||
inkscape --export-filename="$icon_dir/illuscape.png" \
|
||||
--export-type=png \
|
||||
--export-width="$size" --export-height="$size" \
|
||||
"$icon_src" 2>/dev/null && continue
|
||||
fi
|
||||
echo "⚠ Could not rasterize icon at ${size}px (install rsvg-convert for icons)"
|
||||
done
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ def merge(prefs_path: Path, patch_path: Path, preset: str) -> None:
|
|||
_merge_nodes(live_root, patch_root)
|
||||
_apply_preset(live_root, preset)
|
||||
|
||||
live_tree.write(str(prefs_path), encoding="unicode", xml_declaration=True)
|
||||
_atomic_write(live_tree, prefs_path)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue