clean code and changed version nro
[irreco.git] / script / deb-creator.sh
blob0d87c3baca9d9b2b36d15ca625242a8890949fe9
1 #!/bin/bash
3 # TODO version number checking
4 # TODO opt to make debug package of irreco
5 # TODO opt to make just cleaning
7 # Go to folder where this file lies.
8 cd `dirname "$0"`
10 deb_creator_main()
12 echo ""
13 echo "This script is deprecated."
14 echo "You should send sources to compiling queue at maemo.org"
15 echo ""
16 exit 1;
18 COMMAND="$1"
19 if [[ "$COMMAND" == "" ]]; then
20 info_print
21 exit 1
24 case "$COMMAND" in
25 --release|release|rel) enable_rel "${ARGS[@]:2}";;
26 --developer|developer|dev) enable_dev "${ARGS[@]:2}";;
27 *) echo "Error: Unknown command \"$COMMAND\"";
28 info_print;
29 exit 1;;
30 esac
34 info_print()
36 echo ""
37 echo "Usage: deb-creator COMMAND"
38 echo ""
39 echo "Commands:"
40 echo " --release | release | rel"
41 echo " Create Irreco-core release package"
42 echo " --developer | developer | dev"
43 echo " Create a package for backend developers. This will"
44 echo " include Irreco, irreco-util pkg-config files,"
45 echo " irreco-api and irreco-util headers."
46 echo " Only create this package if you need to package backend"
47 echo " and only install this package to Scratchbox."
48 echo ""
49 echo " Deb package will be created to ../debs/"
52 enable_dev()
54 echo ""
55 echo "Creating developer package"
56 echo ""
57 export IRRECO_DEVELOPER=yes
58 cp -fv ../irreco/debian/control-dev ../irreco/debian/control
59 make_deb
62 enable_rel()
64 echo ""
65 echo "Creating release package"
66 echo ""
67 cp -fv ../irreco/debian/control-rel ../irreco/debian/control
68 make_deb
71 make_deb()
73 # Check we are in scratchbox
74 if [[ "$_SBOX_DIR" == "" ||
75 "$_SBOX_RESTART_FILE" == "" ||
76 "$_SBOX_SHELL_PID" == "" ||
77 "$_SBOX_USER_GROUPNAME" == "" ]]; then
78 echo "Error: Need scratchbox."
79 exit 1
82 # Go to irreco-folder
83 cd ../irreco
85 # Clean stuff
86 if [ -e "Makefile" ]; then
87 make uninstall
88 make clean
89 make distclean
91 if [ -e "autoclean.sh" ]; then
92 ./autoclean.sh
95 rm -rfv ./debian/irreco
97 # Create .deb (binary only)
98 dpkg-buildpackage -rfakeroot -B
100 # Ditch .deb to correct directory
101 mkdir -v ../debs/
102 mv -fv ../irreco-core* ../debs/
104 # Clean
105 cd ../script/
106 ./irreco.sh clean
109 deb_creator_main "$@"