-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnmstate.sh
43 lines (36 loc) · 1.13 KB
/
nmstate.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
#! /bin/bash
dnf=dnf
grep -q ostree /proc/cmdline && dnf="dnf --transient"
if test -f /tmp/nmstate_setup.txt; then
exit 0
else
# Enable the newest nispor repo
# dnf copr -y enable nmstate/nispor
# dnf copr -y enable nmstate/nmstate-git
$dnf remove -y \
nmstate python3-libnmstate nmstate-libs nmstate-plugin-ovsdb
if grep -q 'release 8' /etc/redhat-release; then
$dnf install -y \
nispor nmstate-1* nmstate-libs-1* \
python3-libnmstate-1* nmstate-plugin-ovsdb
elif grep -q 'release 9' /etc/redhat-release; then
$dnf install -y \
nispor nmstate-2* nmstate-libs-2* \
python3-libnmstate-2*
fi
rpm -q nmstate; RC=$?
rm -rf nmstate
git clone https://github.com/nmstate/nmstate
pushd nmstate
git checkout v$(rpm -q --queryformat '%{VERSION}' nmstate)
popd
if test $RC -eq 0; then
touch /tmp/nmstate_setup.txt
else
printf "\n\n* INSTALLATION FAILED!\n\n"
fi
# Turn of the nispor repo again
# dnf copr -y disable nmstate/nispor
# dnf copr -y disable nmstate/nmstate-git
exit $RC
fi