summaryrefslogtreecommitdiffstats
path: root/minikrebs/profiles/init_overlay
blob: e71cd151a269ebc8c1d5fa875fa89506028e972a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash 
cd $(dirname $(readlink -f $0))
[ ! -e overlay/ ] && echo "profile data for external overlay does not exist, bailing out"
   
[ -e doc/overlay ] && echo "Profile demands the following partitioning of the overlay usb stick:" && cat doc/OVERLAY

if grep -q $PWD/mnt/overlay /etc/mtab;then
    echo "overlay mounted"
    echo "copying overlay data:"
    find overlay/ -mindepth 1 -maxdepth 1 | while read data; do
        echo "  $data -> mnt/overlay/$(basename $data)"
        rm -rf      mnt/overlay/$(basename $data)
        cp -r $data mnt/overlay
    done
    echo
    echo "unmounting overlay"
    umount mnt/overlay/
else
    mkdir -p $PWD/mnt/overlay
    echo "please mount your overlay to $PWD/mnt/overlay"
fi