From 28e8bdf7f8286bd431b7f3b709e79f3827b31469 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Wed, 24 Dec 2025 13:54:03 +0900 Subject: updates --- debian/.local/bin/syncdic | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 debian/.local/bin/syncdic (limited to 'debian/.local/bin/syncdic') diff --git a/debian/.local/bin/syncdic b/debian/.local/bin/syncdic new file mode 100755 index 0000000..c125f42 --- /dev/null +++ b/debian/.local/bin/syncdic @@ -0,0 +1,33 @@ +#!/bin/sh + +dicfile="${XDG_DATA_HOME:-${HOME}/.local/share}/thesiah/dic" +dest="${XDG_DATA_HOME:-${HOME}/.local/share}/dic" + +[ -d "$dest" ] || mkdir -p "$dest" + +while read -r url; do + [ -z "$url" ] && continue + filename=$(basename "$url") + filepath="${dest}/${filename}" + tarpath=$(echo "$filepath" | sed 's/.zip//;s/.tar.gz//;s/.tgz//;s/.tar.bz2//;s/.tbz2//;s/.tar.xz//;s/.txz//') + + # Download only if the file does not exist + if [ ! -d "$tarpath" ]; then + curl -L "$url" -o "$filepath" + case "$filename" in + *.zip) + unzip -o "$filepath" -d "$dest" + ;; + *.tar.gz | *.tgz) + tar -xzf "$filepath" -C "$dest" + ;; + *.tar.bz2 | *.tbz2) + tar -xjf "$filepath" -C "$dest" + ;; + *.tar.xz | *.txz) + tar -xJf "$filepath" -C "$dest" + ;; + esac + rm -f "$filepath" + fi +done <"$dicfile" -- cgit v1.2.3