]> git.ipfire.org Git - ipfire-2.x.git/blob - src/scripts/packager
b634c7ca829342f41c5d91257a50a22160aad1df
[ipfire-2.x.git] / src / scripts / packager
1 #!/bin/bash
2
3 PROG="$1"
4 VER="$2"
5 PAK_VER="$3"
6 EXT=ipfire
7
8 if [ -f /install/packages/$PROG-$VER-$PAK_VER.tar.gz.empty ]; then
9
10 echo -e "Package already exists."
11
12 else
13
14 # Bringing the files to their right place.
15 rm -rf /install/packages/package /tmp/* /packagetmp.tar
16 mkdir -p /install/packages/package
17 cp -f /usr/src/src/paks/$PROG/{,un}install.sh /install/packages/package
18 cp -f /usr/src/src/paks/$PROG/ROOTFILES /install/packages/package
19 cp -f /usr/src/src/paks/$PROG/depends.txt /install/packages/package
20 chmod 755 /install/packages/package/{,un}install.sh
21
22 cd / && tar --create --directory=/ --files-from=/install/packages/package/ROOTFILES --file=/packagetmp.tar --exclude='#*'
23 cd / && tar -x -C /tmp -f /packagetmp.tar
24 rm -f /packagetmp.tar
25 cd /tmp && tar --create --gzip --verbose --file=/install/packages/package/files.tgz *
26
27 cd / && rm -rf /tmp/*
28 cd /install/packages/package && cat ROOTFILES | grep -v "#" > ROOTFILES
29 tar cfz ../$PROG-${VER}_$PAK_VER.$EXT files.tgz install.sh uninstall.sh ROOTFILES depends.txt
30
31 cd /install/packages && md5sum $PROG*.$EXT > $PROG-${VER}_$PAK_VER.$EXT.md5
32 cd /install/packages && md5sum $PROG*.$EXT >> all-progs.md5
33 rm -rf /install/packages/package
34 exit 0
35 fi