forked from ilius/starcal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-suse
executable file
·172 lines (133 loc) · 4.25 KB
/
install-suse
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
165
166
167
168
169
170
#!/bin/bash
## makes rpm package and installs it using zypper
## rpmbuild command is provided by package "rpm" that is a base and essential package is SUSE
set -e
function check_pkg(){
OUT=`zypper info "$1" | grep 'Installed:'`
if [ "$OUT" = 'Installed: Yes' ] ; then
echo 'installed'
elif [ "$OUT" = 'Installed: No' ] ; then
echo 'not_installed'
else
echo "not_found"
fi
}
if [ "$UID" != "0" ] ; then
echo "Run this script as root" >&2
exit 1
fi
pyCmd=
for minor in 6 5 4 3 2 ; do
cmd="/usr/bin/python3.$minor"
if [ -f "$cmd" ] ; then
pyCmd="$cmd"
break
fi
done
if [ -z "$pyCmd" ] ; then
echo "Please install python3.6 and try again (or older down to python3.2)" >&2
exit 1
fi
echo "Using python: \"$pyCmd\""
pyPkg="$pyCmd"
## --provides and --file-list both work
#pyPkg="`zypper search --match-exact --provides --installed-only \"$pyCmd\" | /bin/grep '^i |' | sed 's/i *| *//' | sed 's/ *|.*//g'`"
# if [ -z "$pyPkg" ] ; then
# echo "Could not find python package name for \"$pyCmd\"" >&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" | sed 's/\-/_/g'`
#echo "myPath=$myPath"
#echo "sourceDir=$sourceDir"
#echo version=$version
requires=("$pyPkg")
requires+=('python3-gobject') ## The new gobject introspection
requires+=('python3-cairo')
requires+=('python3-httplib2')
requires+=('python3-psutil')
requires+=('python3-pymongo')
#requires+=('python3-gflags') # for google api client
## Recommended Packages are treated as strict dependency in openSUSE by default
## unless you uncheck this in Software Management:
## [ ] Dependencies -> Install Recommended Packages
recommends=()
recommends+=('python3-dateutil')
#recommends+=('python3-igraph')
## The package for AppIndicator is: typelib-1_0-AppIndicator3-0_1
## Which provides: typelib(AppIndicator3) = 0.1
## This typelib(AppIndicator3) is automatically added to dependencies of starcal3
## I still don't know why
requires_str=$(printf "Requires: %s\n" "${requires[@]}")
recommends_str=$(printf "Recommends: %s\n" "${recommends[@]}")
#echo "$requires_str"; exit
echo "Name: $pkgName
Version: $version
Release: 1
Summary: A full-featured international calendar written in Python
Group: User Interface/Desktops
License: GPLv3+
URL: http://ilius.github.io/starcal
$requires_str
$recommends_str
BuildArch: noarch
%description
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
%install
\"$sourceDir/install\" \"%{buildroot}\" --for-pkg --prefix=%{_prefix} --python='$pyCmd'
%files
%defattr(-,root,root,-)
%{_prefix}/share/$pkgName/*
%{_prefix}/bin/$pkgName*
%{_prefix}/share/applications/$pkgName.desktop
%{_prefix}/share/doc/$pkgName/*
%{_prefix}/share/pixmaps/$pkgName.png
%{_prefix}/share/icons/hicolor/*/apps/$pkgName.png
%{_prefix}/share/locale/*/LC_MESSAGES/$pkgName.mo
" > $pkgName.spec
#less $pkgName.spec ; exit 0
if [ ! -f /usr/bin/rpmbuild ] ; then
zypper install rpm-build
fi
rpmbuild -bb $pkgName.spec
pkgPath="`ls /usr/src/packages/RPMS/noarch/$pkgName*$version*.rpm`"
echo "pkgPath=$pkgPath"
if [ -z "$pkgPath" ] ; then
echo "Package build failed" >&2
exit 1
fi
if [ ! -f "$pkgPath" ] ; then
echo "Package file $pkgPath does not exit" >&2
exit 1
fi
echo "Package created in \"$pkgPath\", installing"
zypper install -f "$pkgPath"
## Problem: nothing provides /usr needed by $pkgName-1.9.0-3.noarch
## Fixed with defining /usr as Provides
#if [ -f /usr/bin/yum ] ; then
# yum remove -y $pkgName >/dev/null 2>&1
# yum install --nogpgcheck "$pkgPath"
#fi
#rpm -U --force "$pkgPath" ## its OK when required packages are installed!
if [ "`check_pkg gnome-shell`" = installed ] ; then
case `check_pkg gnome-shell-extension-topicons` in
not_installed)
zypper install gnome-shell-extension-topicons
;;
not_found)
zypper ar -f http://download.opensuse.org/repositories/home:/PerryWerneck/openSUSE_13.2/ PerryWerneck && \
zypper refresh && \
zypper install gnome-shell-extension-topicons
;;
esac
fi