# Convert brains file path to url and vice versa
# usage: brains [URL_OR_PATH]
brains() {
- _iki-convert '(/a)?/f/brains' brains.fsf.org "$@"
+ _iki-convert '(/a)?/f/brains' brains.fsf.org/wiki "$@"
}
glue() {
_iki-convert '(/a)?/f/gluestick' gluestick.office.fsf.org "$@"
# usage: $0 REPO_PATH [URL_OR_PATH]
_iki-convert() {
- local url domain path input err repo_dir dir url_dir url
+ local url prefix path input err repo_dir dir url_dir url
repo_dir="$1"
- domain="$2"
+ prefix="$2"
shift 2
err=false
if $err; then
fi
case $input in
http*)
- path="$repo_dir/${input##http*://"$domain"/wiki/}"
+ path="$repo_dir/${input##http*://"$prefix"/}"
if [[ $path == */ ]]; then
path=${path%/}.mdwn
fi
*)
path=$(fp "$input")
url_dir=$(echo "$path" | sed -r "s,^$repo_dir/,,")
- url="https://$domain/wiki/$url_dir"
+ url="https://$prefix/$url_dir"
url="${url%.mdwn}/"
j echo "$url"
;;
if [[ -d /var/lib/bitcoind && -d /p/c/user-specific/bitcoin ]]; then
s rsync -clpgoDiSAX --chmod=Dg-s --chown=bitcoin:bitcoin /p/c/user-specific/bitcoin/settings.json /var/lib/bitcoind
- # i'm not sure of the perfect permissions here, but
- # 640 seems good.
s rsync -rclpgoDiSAX --chmod=Dg-s --chown=root:bitcoin /p/c/user-specific/bitcoin/bitcoin /etc
fi
##### end special extra stuff #####
sudo usermod -a -G bitcoin iank
# todo: make bitcoin have a stable uid/gid
if [[ ! $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
+ mkdir -p /var/lib/bitcoind
+ chown bitcoin:bitcoin /var/lib/bitcoind
+ # 710 comes from the upstream bitcoin unit file
+ chmod 710 /var/lib/bitcoind
s lnf /q/wallets /var/lib/bitcoind
sudo chown -h bitcoin:bitcoin /var/lib/bitcoind/wallets
fi