forked from ilius/starcal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-fedora
executable file
·127 lines (101 loc) · 3.12 KB
/
install-fedora
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
#!/bin/bash
## makes rpm package and installs it using yum
set -e
## yum install @development-tools
## yum install rpm-build rpmdevtools rpmlint mock
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"
if ! which rpmbuild ; then
if which dnf ; then
dnf install rpm-build
elif which yum ; then
yum install rpm-build
else
echo "No 'dnf' nor 'yum' commands were found" >&2
exit 1
fi
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
#%post
#/usr/share/$pkgName/scripts/assert_python3
requires=("$pyPkg")
requires+=('python3-gobject') ## The new gobject introspection
requires+=('python3-cairo')
requires+=('python3-httplib2')
requires+=('python3-psutil')
requires+=('python3-bson')
#requires+=('python3-gflags') # for google api client
#recommends=()
requires+=('python3-dateutil')
#requires+=('python3-igraph')
#requires+=('python3-gnomevfs')
requires_str=$(printf " %s" "${requires[@]}") ; requires_str=${requires_str:1}
#recommends_str=$(printf ", %s" "${recommends[@]}") ; recommends_str=${recommends_str:2}
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: $requires_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*
%{_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
rpmbuild -bb $pkgName.spec
status=$?
if [ "$status" != "0" ] ; then
echo "rpmbuild exited with failed status '$status'" >&2
exit $status
fi
pkgPath="$HOME/rpmbuild/RPMS/noarch/$pkgName-$version-1.noarch.rpm"
if [ ! -f $pkgPath ] ; then
echo "rpmbuild exited with success status $status, but no package file was found" >&2
exit 1
fi
echo "Package created in \"$pkgPath\", installing"
yum remove -y $pkgName >/dev/null 2>&1
yum install --nogpgcheck "$pkgPath" ## disable gpgcheck in /etc/yum.conf
#rpm -U --force "$pkgPath" ## its OK when required packages are installed!