summaryrefslogtreecommitdiff
path: root/debian/.local/bin/syncdic
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-12-24 13:54:03 +0900
commit28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch)
tree85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/syncdic
parent8470ff001befcfd0f626dea69a9e76d43aee0511 (diff)
updates
Diffstat (limited to 'debian/.local/bin/syncdic')
-rwxr-xr-xdebian/.local/bin/syncdic33
1 files changed, 33 insertions, 0 deletions
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"