summaryrefslogtreecommitdiff
path: root/bin/genSkelTar.sh
blob: 8b881d37cc89549e97af0c007635af21e77047db (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
#!/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 "# ${datestamp}" >> .gitignore

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

	# find changed files
	find gen -type f | 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
	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