dotfiles

Alpine Linux dotfiles

git clone git://git.lin.moe/dotfiles.git

 1#!/usr/bin/env zsh
 2
 3opts=
 4: ${DOAS:="doas"}
 5while getopts "hn" opt; do
 6    case $opt in
 7        h)
 8            echo "usage: $0 SRC_DIR DEST_DIR [-n]"
 9            exit 0
10            ;;
11        n)
12            opts=($opts --dry-run)
13            ;;
14    esac
15done
16shift $((OPTIND-1))
17
18src=${1:-"/"}
19dest=${2:-"tei::backup/sys/$(hostname)/"}
20
21if [ -f "$src/.rsync.files" ]; then
22    opts=($opts --files-from $src/.rsync.files)
23fi
24if [ -f "$src/.rsync.exclude" ]; then
25    opts=($opts --exclude-from $src/.rsync.exclude)
26fi
27if [ -f "$src/.rsync.include" ]; then
28    opts=($opts --include-from $src/.rsync.include)
29fi
30if [ -f "$src/.rsync.filter" ]; then
31    opts=($opts --filter="merge $src/.rsync.filter")
32fi
33
34echo $opts
35echo $dest
36$DOAS rsync --archive --one-file-system --inplace --hard-links \
37      --human-readable --numeric-ids --delete --delete-excluded \
38      --acls --xattrs --sparse \
39      --itemize-changes --verbose --progress \
40      --exclude='*~' --exclude=__pycache__ \
41      $opts $src $dest
42
43function() {
44    function() {
45    }
46}