summaryrefslogtreecommitdiff
path: root/bin/genSkelTar.sh
blob: caa1326208ca97f328ea1afd4e12c4f4337e3590 (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
35
36
37
38
39
40
41
42
43
#!/bin/bash

# goto root dir (this script resides in bin)
BASEDIR=`dirname $(readlink -f $0)`
cd ${BASEDIR}/../

# cleanup old files
#echo "cleaning up"
rm -f www/skel.tar.gz www/skel.tar
rm -rf gen

# generate files in 'gen'
# echo "updating source repositories"
git submodule update --init
git submodule update

datestamp=`date --iso-8601=date`
echo -n "# autogenerated on ${datestamp}" >> .gitignore

for file in `find src -maxdepth 1 -type f -executable | sort`; do
	mkdir gen
	echo "generating ${file}"
	$file >/dev/null

	# find changed files
	find gen -type f | sort | while read gen_file ; do
		home_file=`echo $gen_file | sed 's/^gen/home/'`
		cp .gitignore .gitignore.old
		cat .gitignore.old | grep -Fv "$home_file" > .gitignore
		echo "$home_file" >> .gitignore
		mkdir -p `dirname "$home_file"`
		cp "$gen_file" "$home_file"
		rm -f .gitignore.old
	done
	rm -rf gen
done

# pack files to skel.tar
echo "packing home/"
tar -cf www/skel.tar home
# compress to skel.tar.gz
echo "compressing to skel.tar.gz"
gzip www/skel.tar