diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/syncdic | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/syncdic')
| -rwxr-xr-x | debian/.local/bin/syncdic | 33 |
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" |
