dot rc

Sign in or create your account | Project List | Help

dot rc Git Source Tree

Root/skel.sh

1#!/bin/bash
2
3skip=()
4
5inst()
6{
7    src="$1"
8    dest="$2"
9
10    mkdir -p "${dest%/*}"
11    rm -f "$dest"
12    cp -Rp "$src" "$dest"
13    echo "installed $src"
14}
15
16make
17rm -fr skel
18mkdir skel
19
20git ls-files rc/ | while read f; do
21    [ -n "${f##*.gitignore*}" ] || continue
22    [ -e "$f" ] || continue
23    for s in "${skip[@]}"; do
24        [ "$s" = "$f" ] && break
25    done
26    [ "$s" = "$f" ] && continue
27    inst "$f" "skel/.${f#*/}"
28done
29
30sys=`uname`
31
32if [ -d opt/noarch ]; then
33    mkdir -p skel/opt/noarch/misc/bin
34    git ls-files opt/noarch | xargs -r cp -Rp -t skel/opt/noarch/misc/bin
35fi
36
37if [ -d opt/$sys/noarch ]; then
38    mkdir -p skel/opt/noarch/$sys/bin
39    git ls-files opt/$sys/noarch | xargs -r cp -Rp -t skel/opt/noarch/$sys/bin
40fi
41
42find skel -name .gitignore -print0 | xargs -r0 rm -f
43find skel ! -type l -print0 | xargs -r0 chmod g-w
44
45for h; do
46    d="${h#*:}"
47    [ "$d" != "$h" ] || d=.
48    h="${h%%:*}"
49    rsync -rltpv skel/ $h:${d:-.}/
50done
51

Archive Download this file

Branches:
master