-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.tmp
67 lines (66 loc) · 1.45 KB
/
script.tmp
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
#!/bin/sh
ch_path=$1
reply=$2
echo $ch_path $reply
dev_file=UPSmart
dev_name=UPSmart
dev_tar=UPSmart.tar.gz
cur_dir=$(pwd)
uid=$(id | cut -d'=' -f2 | cut -d'(' -f1)
if [ $uid -ne 0 ];then
echo '\nRequires running as root!\nRun:\n\n sudo ./Installer_UPSmart_linux_x86_64\n'
exit 1
fi
echo "The installation path is '/opt'."
echo "Do you want to change it ? [ y ro n]:"
if [ -z $ch_path ];then
read ch_path leftover
fi
case $ch_path in
y* | Y*)
echo "Please input the new installation path:";
read new_path leftover;
install_dir=$new_path ;
;;
n* | N*)
install_dir=/opt;
;;
esac
if [ -x $install_dir ] ; then
echo "The installation path is correct ."
cd $install_dir
if [ -x $install_dir/$dev_file ] ; then
cd $cur_dir
else
mkdir $dev_file
cd $cur_dir
fi
if [ -x $install_dir/$dev_file ] ; then
echo "Create the document successfully ."
tail -n +68 $0 > $install_dir/$dev_file/$dev_tar
cd $install_dir/$dev_file
echo "Has been successfully in obtaining the files ."
tar -xzvf $dev_tar
chmod 777 -R ./
cp -f ./UPSmart.desktop /usr/share/applications/
echo "The software has been installed successfully ."
echo "Do you want to run this software now ? [y or n]:"
if [ -z $reply ];then
read reply leftover
fi
case $reply in
y* | Y*)
./$dev_name
;;
n* | N*)
echo "Exit 0";
;;
esac
else
echo "Can't create the document or no permission !";
fi
else
echo "Can't find the path or no permission !";
fi
echo "Done."
exit 0