From 6baef1437fcf40b1d51c5255af78ab297d361d2c Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 23 Aug 2025 13:36:06 +0900 Subject: updates --- mac/.local/bin/syncdic | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 mac/.local/bin/syncdic (limited to 'mac/.local/bin/syncdic') diff --git a/mac/.local/bin/syncdic b/mac/.local/bin/syncdic new file mode 100755 index 0000000..c125f42 --- /dev/null +++ b/mac/.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