OSDN Git Service

Modify package scripts for 1.5
[neighbornote/NeighborNote.git] / package_scripts / deb / build.sh
1 #!/bin/sh
2
3 version="1.5"
4 arch="i386"
5 qtversion="4.5.2_01" 
6
7
8 package_dir=$(cd `dirname $0` && pwd)
9
10 destination="$package_dir/contents/usr/share/nixnote"
11 source_dir="../.."
12 qtlibs="../../../bitrock/lib"
13 qtarch="32"
14
15 if [ "$(id -u)" != "0" ]; then
16    echo "This script must be run as root" 1>&2
17    exit 1
18 fi
19
20
21 #Do any parameter overrides
22 while [ -n "$*" ]
23 do
24    eval $1
25    shift
26 done
27
28
29 if [ "$arch" = "amd64" ]; then
30   qtarch="64"
31 fi
32
33
34 # Cleanup any old stuff
35
36 if [ -e "$package_dir/nixnote-${version}_${arch}.deb" ] 
37 then
38    rm $package_dir/nixnote-${version}_${arch}.deb
39 fi
40
41 if [ -e "$package_dir/nixnote-${version}_${arch}.rpm" ] 
42 then
43    rm $package_dir/nixnote-${version}_${arch}.rpm
44 fi
45
46 ############################
47 # Copy the things we need  #
48 ############################
49
50 # Create directories
51 mkdir $package_dir/contents
52 mkdir $package_dir/contents/usr/
53 mkdir $package_dir/contents/usr/share
54 mkdir $package_dir/contents/usr/share/applications
55 mkdir $package_dir/contents/usr/share/nixnote
56 mkdir $package_dir/contents/usr/share/man
57 mkdir $package_dir/contents/usr/share/man/man1
58 mkdir $package_dir/contents/usr/bin/
59 mkdir $package_dir/contents/usr/share/doc
60 mkdir $package_dir/contents/usr/share/doc/nixnote
61
62 # Copy startup script & images
63 cp $source_dir/nixnote.sh $package_dir/contents/usr/share/nixnote/
64 cp $source_dir/*.txt $package_dir/contents/usr/share/nixnote/
65 cp $source_dir/*.html $package_dir/contents/usr/share/nixnote/
66 cp $source_dir/*.png $package_dir/contents/usr/share/nixnote/
67 cp $source_dir/nixnote.desktop $package_dir/contents/usr/share/applications
68 cp $source_dir/nixnote_path.sh $package_dir/contents/usr/bin/nixnote
69 cp $source_dir/copyright $package_dir/contents/usr/share/doc/nixnote
70 gzip -c -9 $source_dir/changelog.txt > $package_dir/contents/usr/share/doc/nixnote/changelog.gz
71 gzip -c -9 $source_dir/changelog.txt > $package_dir/contents/usr/share/doc/nixnote/changelog.Debian.gz
72
73
74 # Copy subdirectories
75 cp -r $source_dir/images $package_dir/contents/usr/share/nixnote/
76 cp -r $source_dir/lib $package_dir/contents/usr/share/nixnote/
77 cp -r $source_dir/qss $package_dir/contents/usr/share/nixnote/
78 cp -r $source_dir/spell $package_dir/contents/usr/share/nixnote/
79 cp -r $source_dir/translations $package_dir/contents/usr/share/nixnote/
80 cp -r $source_dir/xml $package_dir/contents/usr/share/nixnote/
81
82
83 # Copy QT libraries.
84 cp $qtlibs/qtjambi-linux$qtarch-$qtversion.jar $package_dir/contents/usr/share/nixnote/lib/
85 cp $qtlibs/qtjambi-linux$qtarch-gcc-$qtversion.jar $package_dir/contents/usr/share/nixnote/lib/
86
87 # Copy NixNote itself
88 cp $qtlibs/../nixnote.jar $package_dir/contents/usr/share/nixnote/
89
90 # Reset user permissions
91 chown -R root:root $package_dir/contents/
92
93
94 # Copy control file for the package
95 mkdir $package_dir/contents/DEBIAN
96 cp $package_dir/$arch/control ./contents/DEBIAN/
97
98 # Gzip the man page
99 gzip -c -9 $source_dir/man/nixnote.1 > $package_dir/contents/usr/share/man/man1/nixnote.1.gz
100
101 dpkg -b $package_dir/contents $package_dir/nixnote-${version}_${arch}.deb
102 alien -r $package_dir/nixnote-${version}_${arch}.deb
103
104 # Cleanup
105 rm -rf $package_dir/contents
106
107 # Check package
108 #lintian $package_dir/contents $package_dir/nixnote-${version}_${arch}.deb