forked from ilius/starcal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-debian
executable file
·96 lines (74 loc) · 2.54 KB
/
install-debian
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
#!/bin/bash
## This script builds DEB package on a debian-based distribution
## (like debian, ubuntu, mint, ...) and installs the package
set -e
function getDirTotalSize(){
du -ks "$1" | python3 -c "import sys;print(input().split('\t')[0])"
}
if [ "$UID" != "0" ] ; then
echo "Run this script as root" >&2
exit 1
fi
myPath="$0"
if [ "${myPath:0:2}" == "./" ] ; then
myPath=$PWD${myPath:1}
elif [ "${myPath:0:1}" != "/" ] ; then
myPath=$PWD/$myPath
fi
pkgName=starcal3
sourceDir="`dirname \"$myPath\"`"
#"$sourceDir/scripts/assert_python3"
version=`"$sourceDir/scal3/get_version.py"`
tmpDir=/tmp/$pkgName-install-deb
mkdir -p $tmpDir
mkdir -p "$tmpDir/DEBIAN"
"$sourceDir/install" "$tmpDir" "--for-pkg"
chown -R root "$tmpDir"
installedSize=`getDirTotalSize "$tmpDir"` ## only /usr ? FIXME
#getDirTotalSize "$tmpDir"
#getDirTotalSize "$tmpDir/usr"
depends=('python3.6 | python3.5 | python3.4 | python3.3 | python3.2')
depends+=('gir1.2-gtk-3.0')
depends+=('python3-gi(>=3.8)') ## The new gobject introspection
depends+=('python3-gi-cairo(>=3.8)')
## it's "python-gobject-cairo" in ubuntu FIXME
depends+=('python3-httplib2')
depends+=('python3-psutil')
depends+=('python3-bson')
#depends+=('python3-gflags') # for google api client
recommends=()
recommends+=('python3-dateutil')
recommends+=('python3-igraph') ## FIXME
recommends+=('python3-gnomevfs')
depends_str=$(printf ", %s" "${depends[@]}") ; depends_str=${depends_str:2}
recommends_str=$(printf ", %s" "${recommends[@]}") ; recommends_str=${recommends_str:2}
mkdir -p $tmpDir/DEBIAN
echo "Package: $pkgName
Version: $version
Architecture: all
Maintainer: Saeed Rasooli <[email protected]>
Installed-Size: $installedSize
Depends: $depends_str
Recommends: $recommends_str
Section: Utilities
Priority: optional
Homepage: http://ilius.github.io/starcal
Description: A full-featured international calendar written in Python
StarCalendar is a full-featured international calendar written in Python,
using Gtk3-based interface, that supports Jalai(Iranian), Hijri(Islamic),
and Indian National calendars, as well as common English(Gregorian) calendar
Homepage: http://ilius.github.io/starcal
" > "$tmpDir/DEBIAN/control"
#echo "/usr/share/$pkgName/scripts/assert_python3" > "$tmpDir/DEBIAN/postinst"
#chmod 755 "$tmpDir/DEBIAN/postinst"
pkgFile=${pkgName}_${version}-1_all.deb
if dpkg-deb -b "$tmpDir" "$pkgFile" ; then
echo "Package file $pkgFile created, installing..."
if [ -f /usr/bin/gdebi ] ; then
/usr/bin/gdebi "$pkgFile"
else
apt-get install python3-httplib2
dpkg -i "$pkgFile"
fi
fi
rm -Rf "$tmpDir"