Skip to content

Commit 064ffaf

Browse files
author
Amal John Ronkha
committed
Installer for kvmgr added
1 parent 6897022 commit 064ffaf

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

install.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
ins_path=/usr/bin
4+
bin_name=kvmgr
5+
red='\033[0;31m\033[1m'
6+
green='\033[0;32m\033[1m'
7+
yellow='\033[0;33m\033[1m'
8+
red() {
9+
echo -e "${red}$@${end}"
10+
}
11+
12+
yellow() {
13+
echo -e "${yellow}$@${end}"
14+
}
15+
green() {
16+
echo -e "${green}$@${end}"
17+
}
18+
if [[ $UID -ne 0 ]]; then
19+
red "Installation needs sudo user or root!"
20+
exit
21+
fi
22+
23+
checkf=1
24+
if [[ -f $ins_path/$bin_name ]]; then
25+
old=`md5sum /usr/bin/$bin_name | awk '{print $1}'`;
26+
new=`md5sum $PWD/$bin_name | awk '{print $1}'`
27+
checkf=0
28+
fi
29+
30+
if [[ $checkf -eq 0 ]]; then
31+
if [[ $old = $new ]]; then
32+
yellow "$bin_name is already installed and is in the latest version!"
33+
else
34+
cp $PWD/$bin_name $ins_path >/dev/null >&1
35+
if [[ $? -eq 0 ]]; then
36+
green "Updated KVM Manager successfully!"
37+
else
38+
red "Failed to update KVM Manager!"
39+
fi
40+
fi
41+
else
42+
cp $PWD/$bin_name $ins_path >/dev/null >&1
43+
if [[ $? -eq 0 ]]; then
44+
green "Installed KVM Manager successfully!"
45+
else
46+
red "Failed to install KVM Manager!"
47+
fi
48+
fi
49+

0 commit comments

Comments
 (0)