aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-08-01 09:54:24 +0200
committerCharles Cabergs <me@cacharle.xyz>2021-08-01 09:54:24 +0200
commit0cc6f0cc54c70331aefa4fc32628c1722f5a38fd (patch)
treed2dbb017d3cd3c233dad7b0bbc4671840944f662
parent25fc1f6c58c829f9897f3b5371bb465f3346ccb1 (diff)
downloaddotfiles-0cc6f0cc54c70331aefa4fc32628c1722f5a38fd.tar.gz
dotfiles-0cc6f0cc54c70331aefa4fc32628c1722f5a38fd.tar.bz2
dotfiles-0cc6f0cc54c70331aefa4fc32628c1722f5a38fd.zip
Updated install script to install dictionaries locally instead of /usr/share/stardict
-rw-r--r--config/zsh/aliases.zsh7
-rwxr-xr-xconfig/zsh/zprofile1
-rwxr-xr-xinstall57
3 files changed, 44 insertions, 21 deletions
diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh
index ede9fda..6541211 100644
--- a/config/zsh/aliases.zsh
+++ b/config/zsh/aliases.zsh
@@ -158,3 +158,10 @@ alias zathura='zathura --fork'
alias xset-reset='xset r rate 200 50'
alias open='xdg-open'
alias csi='rlwrap chicken-csi'
+
+sdcv() {
+ /usr/bin/sdcv -n --utf8-output --color "$@" 2>&1 |
+ fold -s -w "$(tput cols)"
+}
+
+alias ffmpeg='ffmpeg -hide_banner'
diff --git a/config/zsh/zprofile b/config/zsh/zprofile
index 9a26525..ee2d4ab 100755
--- a/config/zsh/zprofile
+++ b/config/zsh/zprofile
@@ -38,6 +38,7 @@ export CARGO_HOME="$XDG_DATA_HOME/cargo"
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH"
export RLWRAP_HOME="$XDG_DATA_HOME/rlwrap"
+export STARDICT_DATA_DIR="$XDG_DATA_HOME/stardict" # put dictionaries in a 'dic' subdirectory
# cache
export HISTFILE="$XDG_CACHE_HOME/zsh/history"
export LESSHISTFILE='-' # no ~/.lesshst
diff --git a/install b/install
index bb72883..825bfac 100755
--- a/install
+++ b/install
@@ -7,24 +7,21 @@
if [ "$USER" = 'root' ]
then
crontab 'crontab/root.crontab'
-
- install_dict() {
- url="$1"
- archive_name="$(basename "$url")"
- dir_name="${archive_name%%.tar.bz2}"
- install_dir='/usr/share/stardict/dic'
- [ ! -d "$install_dir" ] && mkdir -pv "$install_dir"
- [ -d "$install_dir/$dir_name" ] && return
- echo "----------------------------- Installing dictionary: $dir_name"
- curl "$url" | tar -xjvf - -C "$install_dir" &
- }
- # other dictionaries at: http://download.huzheng.org/
- install_dict 'http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2' # english
- install_dict 'http://download.huzheng.org/fr/stardict-xmlittre-2.4.2.tar.bz2' # french
-
exit
fi
+parallel_pids=''
+
+parallel_start() {
+ "$@" & parallel_pids="$parallel_pids $!"
+}
+
+parallel_wait() {
+ # shellcheck disable=SC2086
+ wait $parallel_pids
+ parallel_pids=''
+}
+
mkdir -pv "$XDG_CONFIG_HOME"
mkdir -pv "$XDG_DATA_HOME"
mkdir -pv "$XDG_CACHE_HOME"
@@ -89,12 +86,10 @@ update_zsh_plugin()
}
mkdir -p "$XDG_DATA_HOME/zsh"
-update_zsh_plugin 'https://github.com/sindresorhus/pure' & pids="$pids $!"
-update_zsh_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting' & pids="$pids $!"
-update_zsh_plugin 'https://github.com/MichaelAquilina/zsh-you-should-use' & pids="$pids $!"
-# Parallel downloads are faster
-# shellcheck disable=SC2086
-wait $pids
+parallel_start update_zsh_plugin 'https://github.com/sindresorhus/pure'
+parallel_start update_zsh_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting'
+parallel_start update_zsh_plugin 'https://github.com/MichaelAquilina/zsh-you-should-use'
+parallel_wait
###############################################################################
# crontab
@@ -103,3 +98,23 @@ wait $pids
echo '---------------------------- INSTALL CRONTAB -----------------------------'
crontab 'crontab/user.crontab'
echo 'INFO: Run this script as root if you want to install the root contab'
+
+###############################################################################
+# dictionaties
+###############################################################################
+
+echo '---------------------------- INSTALL CRONTAB -----------------------------'
+install_dict() {
+ url="$1"
+ archive_name="$(basename "$url")"
+ dir_name="${archive_name%%.tar.bz2}"
+ install_dir="${STARDICT_DATA_DIR:-/usr/share/stardict}/dic"
+ [ ! -d "$install_dir" ] && mkdir -pv "$install_dir"
+ [ -d "$install_dir/$dir_name" ] && return
+ echo "----------------------------- Installing dictionary: $dir_name"
+ curl "$url" | tar -xjvf - -C "$install_dir" &
+}
+# other dictionaries at: http://download.huzheng.org/
+parallel_start install_dict 'http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2' # english
+parallel_start install_dict 'http://download.huzheng.org/fr/stardict-xmlittre-2.4.2.tar.bz2' # french
+parallel_wait