-
Notifications
You must be signed in to change notification settings - Fork 22
/
install.sh
executable file
·67 lines (53 loc) · 1.41 KB
/
install.sh
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
#!/bin/bash
## makes rpm package and installs it using yum
set -e
distro=fedora
## 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
if ! git --version ; then
if ! dnf install git-core ; then
echo -e "\n\nPlease install git and try again" >&2
exit 1
fi
fi
if ! which msgfmt ; then
dnf install gettext
fi
if [ ! -f /usr/bin/python3 ] ; then
echo "/usr/bin/python3 was not found" >&2
exit 1
fi
pyCmd=/usr/bin/python3
echo "Using python: \"$pyCmd\""
pkgName=starcal3
myPath=$(realpath "$0")
myDir1=$(dirname "$myPath")
myDir2=$(dirname "$myDir1")
sourceDir=$(dirname "$myDir2")
DTIME=$(/bin/date +%F-%H%M%S)
outDir="$HOME/.${pkgName}/pkgs/$distro/$DTIME"
mkdir -p "$outDir"
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
"$sourceDir/distro/$distro/build.sh" "$outDir" "$pyCmd"
pkgPath=$(find "$outDir" -maxdepth 1 -name '*.rpm' | sort | tail -n1)
if [ ! -f "$pkgPath" ] ; then
echo "rpmbuild exited with success status, but no package file was found" >&2
exit 1
fi
echo "Package created in \"$pkgPath\", installing"
dnf remove -y $pkgName >/dev/null 2>&1 || true
dnf install --nogpgcheck "$pkgPath"
#rpm -U --force "$pkgPath" ## its OK when required packages are installed!