summaryrefslogtreecommitdiff
path: root/bin/mkoverlay
blob: d11a7ada119a0e58789bff76db26384fb5396f9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# = Parabola Social
# This script is released in the Public Domain

# Copies a system config file for creating a Parabola Social overlay
# It also recreates the source dir tree.

overlay_dir=/home/fauno/pkg/ParabolaSocial/overlay

[[ ! -d ${overlay_dir} ]] && {
    echo "The overlay directory doesn't exists or it's not configured."
    exit 1
}

for file in $@; do
    fullfile=`readlink -f ${file}`
    destfile=${overlay_dir}${fullfile}

    [[ -f ${destfile} ]] && {
        echo "The file already exists"
        continue
    }

    [[ ! -d `dirname ${destfile}` ]] && {
        mkdir -p `dirname "${destfile}"`
    }

    sudo cp -p "${fullfile}" "${destfile}" || {
        echo "Couldn't copy file"
        exit 2
    }
done

exit 0