~helene-verhaeghe27/cairo-dock-core/bugfix

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh

export CAIRO_DOCK_DIR=`pwd`/..
export FAST_COMPIL="0"
export BUILD_TAR="0"

echo "packaging options : "
while getopts "d:fTh" flag
do
	echo " option $flag" $OPTIND $OPTARG
	case "$flag" in
	d)
		echo " => use folder $OPTARG"
		export CAIRO_DOCK_DIR="$OPTARG"
		;;
	f)
		echo " => fast compil"
		export FAST_COMPIL="1"
		;;
	T)
		echo " => build tar"
		export BUILD_TAR="1"
		;;
	h)
		echo "-d rep : build in the folder 'rep'"
		echo "-f : fast compil (don't clean the sources before (use it with caution))"
		echo "-T : build the sources tarball"
		exit 0
		;;
	*)
		echo "unexpected argument"
		exit 1
		;;
	esac
done


#\_____________ On nettoie un peu les sources.
read -p "Use folder '$CAIRO_DOCK_DIR' ? [Y/n]" clean
if test "$clean" = "n" -o  "$clean" = "N"; then
	exit 0
fi
cd $CAIRO_DOCK_DIR
find . -name "*~" -delete
find . -name "core*" -delete
find . -name ".#*" -delete
rm -rf plug-ins/conf*[0-9]
rm -f cairo-dock*.tar.bz2 *.deb

if ! test  -d cairo-dock -o ! -d themes -o ! -d plug-ins -o ! -d deb -o ! -d deb-plug-ins; then
	echo "Attention : folder missing in $CAIRO_DOCK_DIR !"
	exit 1
fi

cd $CAIRO_DOCK_DIR/themes
./cairo-dock-finalize-theme.sh

cd $CAIRO_DOCK_DIR
sudo rm -rf deb/usr
sudo rm -rf deb-plug-ins/usr
mv deb/.svn .svn-deb
mv deb-plug-ins/.svn .svn-deb-plug-ins

cd $CAIRO_DOCK_DIR/deb
if test -e debian; then
	mv debian DEBIAN
fi
cd $CAIRO_DOCK_DIR/deb-plug-ins
if test -e debian; then
	mv debian DEBIAN
fi

#\_____________ On compile de zero.
if test "$FAST_COMPIL" = "0"; then
	cd $CAIRO_DOCK_DIR/cairo-dock
	./compile-all.sh -a -c -C -i -t -d $CAIRO_DOCK_DIR
fi

#\_____________ On cree les archives.
if test "$BUILD_TAR" = "1"; then
	echo "***************************"
	echo "* Generating tarballs ... *"
	echo "***************************"
	echo ""
	echo "building dock tarball ..."
	cd $CAIRO_DOCK_DIR/cairo-dock
	make dist-bzip2 > /dev/null
	mv cairo-dock*.tar.bz2 ..
	
	echo "building themes tarball ..."
	cd $CAIRO_DOCK_DIR/themes
	make dist-bzip2 > /dev/null
	mv cairo-dock*.tar.bz2 ..
	
	echo "building plug-ins tarball ..."
	cd $CAIRO_DOCK_DIR/plug-ins
	make dist-bzip2 > /dev/null
	mv cairo-dock*.tar.bz2 ..
fi

#\_____________ On cree les paquets.
echo "***************************"
echo "* Generating packages ... *"
echo "***************************"
echo ""
cd $CAIRO_DOCK_DIR
sudo chmod -R 755 deb deb-plug-ins

echo "building dock package ..."
cd $CAIRO_DOCK_DIR/deb
sudo mkdir usr
sudo mkdir usr/bin
sudo mkdir usr/share
sudo mkdir usr/share/menu
sudo mkdir usr/share/applications
sudo mkdir usr/share/pixmaps
for lang in `cat ../cairo-dock/po/LINGUAS`; do
	sudo mkdir -p usr/share/locale/$lang/LC_MESSAGES
	sudo cp /usr/share/locale/$lang/LC_MESSAGES/cairo-dock.mo usr/share/locale/$lang/LC_MESSAGES
done;

sudo cp /usr/bin/cairo-dock usr/bin
sudo cp /usr/bin/launch-cairo-dock-after-beryl.sh usr/bin
sudo cp /usr/bin/cairo-dock-update.sh usr/bin
sudo cp -rpP /usr/share/cairo-dock/ usr/share/
sudo rm -rf usr/share/cairo-dock/plug-ins
sudo cp ../cairo-dock/data/cairo-dock.svg usr/share/pixmaps
sudo cp ../cairo-dock/data/cairo-dock usr/share/menu
sudo cp ../cairo-dock/data/cairo-dock.desktop usr/share/applications

cd $CAIRO_DOCK_DIR
sed "s/^Version:.*/Version: "`cairo-dock --version`"/g" deb/DEBIAN/control > tmp
mv tmp deb/DEBIAN/control
dpkg -b deb "cairo-dock_v`cairo-dock --version`_`uname --machine`.deb"


echo "building plug-ins package ..."
cd $CAIRO_DOCK_DIR/deb-plug-ins
for lang in `cat ../cairo-dock/po/LINGUAS`; do
	sudo mkdir -p usr/share/locale/$lang/LC_MESSAGES
	sudo cp /usr/share/locale/$lang/LC_MESSAGES/cd-*.mo usr/share/locale/$lang/LC_MESSAGES
done;
sudo mkdir -p usr/share/cairo-dock
sudo cp -r /usr/share/cairo-dock/plug-ins usr/share/cairo-dock
sudo mkdir -p usr/lib
sudo cp -r /usr/lib/cairo-dock usr/lib
sudo rm -f usr/lib/cairo-dock/*.la

cd $CAIRO_DOCK_DIR
sed "s/^Version:.*/Version: "`cairo-dock --version`"/g" deb-plug-ins/DEBIAN/control > tmp
mv tmp deb-plug-ins/DEBIAN/control
dpkg -b deb-plug-ins "cairo-dock-plug-ins_v`cairo-dock --version`_`uname --machine`.deb"

mv .svn-deb deb/.svn
mv .svn-deb-plug-ins deb-plug-ins/.svn


#\_____________ On liste les sommes de controle des fichiers.
cd $CAIRO_DOCK_DIR
rm -f md5sum.txt
for f in *.deb *.bz2; do echo `md5sum $f`>> md5sum.txt; done;
echo "generated files :"
echo "----------------"
cat md5sum.txt