Add elpa script

This commit is contained in:
ZenithalHourlyRate 2021-12-18 01:03:10 +08:00
parent 875d492ca8
commit 3991814ac5
No known key found for this signature in database
GPG Key ID: 1189C659F3D04C1C

48
elpa.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# requires: rsync lftp
set -e
set -o pipefail
RSYNC_OPTS="-aHvh --no-o --no-g --stats --exclude .~tmp~/ --delete --delete-excluded --delete-after --delay-updates --safe-links --timeout=120 --contimeout=120"
USE_IPV6=${USE_IPV6:-"0"}
if [[ $USE_IPV6 == "1" ]]; then
RSYNC_OPTS="-6 ${RSYNC_OPTS}"
fi
UPSTREAMS=(
"rsync://elpa.gnu.org/elpa/"
"rsync://elpa.nongnu.org/nongnu/"
"rsync://melpa.org/packages/"
"rsync://stable.melpa.org/packages/"
)
REPOS=(
"gnu"
"nongnu"
"melpa"
"stable-melpa"
)
for I in ${!UPSTREAMS[@]}; do
upstream=${UPSTREAMS[$I]}
repo=${REPOS[$I]}
dest=${TUNASYNC_WORKING_DIR}/${repo}
[ ! -d "$dest" ] && mkdir -p "$dest"
rsync ${RSYNC_OPTS} "$upstream" "$dest"
done
# org-mode
org() {
dest=${TUNASYNC_WORKING_DIR}/org
echo $dest
[ ! -d "$dest" ] && mkdir -p "$dest"
cd $dest
lftp "https://orgmode.org/elpa/" -e 'mirror -v -P 5 --delete --no-recursion; bye'
}
org