-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall
executable file
·144 lines (129 loc) · 4.06 KB
/
install
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
WHI="$(tput setaf 7)"
GRE="$(tput setaf 2)"
RED="$(tput setaf 1)"
clear
echo -en "${WHI}"
cat <<'EOF'
PISTAR-LASTQSO INSTALLATION:
This install script will perform the following operations...
1.) remount the rootfs filesystem as read-write
2.) copy "pistar-lastqso" to /usr/local/bin and enable execute permission
3.) copy "dxcc.pl" script to /usr/local/bin and enable execute permission
4.) install the packages "figlet" and "jq" from the standard repositories
5.) copy the supplemental "ansi_shadow.flf" font file to /usr/share/figlet
6.) populate the dxcc, license (US), and grid (US) caches w/ callsign data
7.) remount the rootfs filesystem as read-only
EOF
echo -en "Press ENTER to proceed, or Ctrl-C to abort... "
read FOO
echo -e "Beginning install."
#----------
echo -e "${GRE}Step 1. - Mounting rootfs filesystem as read-write...${WHI}"
sudo mount -o remount,rw /
#----------
echo -e "${GRE}Step 2. - Installing the pistar-lastqso script...${WHI}"
if [ ! -f ./pistar-lastqso ]
then
echo -e "${RED}\n Error... pistar-lastqso not found in current directory.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
else
if [ -f /usr/local/sbin/pistar-lastqso ]
then
sudo rm /usr/local/sbin/pistar-lastqso 2> /dev/null
fi
if [ "$(sudo cp ./pistar-lastqso /usr/local/bin 2> /dev/null)" ]
then
echo -e "${RED}\n Unable to copy script to /usr/local/bin.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
fi
if [ "$(sudo chmod +x /usr/local/bin/pistar-lastqso 2> /dev/null)" ]
then
echo -e "${RED}\n Unable to set execute permission.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
fi
fi
#----------
echo -e "${GRE}Step 3. - Installing the dxcc.pl script...${WHI}"
if [ ! -f ./dxcc.pl ]
then
echo -e "${RED}\n Error... dxcc.pl not found in current directory.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
else
if [ "$(sudo cp ./dxcc.pl /usr/local/bin 2> /dev/null)" ]
then
echo -e "${RED}\n Unable to copy script to /usr/local/bin.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
fi
if [ "$(sudo chmod +x /usr/local/bin/dxcc.pl 2> /dev/null)" ]
then
echo -e "${RED}\n Unable to set execute permission.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
fi
fi
#----------
if [ -n "$(command -v figlet)" ]
then
echo -e "${GRE}Step 4a. - Figlet is already installed. Continuing...${WHI}"
else
echo -e "${GRE}Step 4a. - Installing figlet from the repositories...${WHI}"
sudo apt-get -y install figlet
fi
#----------
if [ -n "$(command -v jq)" ]
then
echo -e "${GRE}Step 4b. - jq is already installed. Continuing...${WHI}"
else
echo -e "${GRE}Step 4b. - Installing jq from the repositories...${WHI}"
sudo apt-get -y install jq
fi
#----------
if [ ! -f /usr/share/figlet/ansi_shadow.flf ]
then
if [ ! -f ./ansi_shadow.flf ]
then
echo -e "${RED}\n Error... ansi_shadow.flf not found in current directory.${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
else
echo -e "${GRE}Step 5. - Installing ansi_shadow font...${WHI}"
if [ "$(sudo cp ./ansi_shadow.flf /usr/share/figlet/ansi_shadow.flf 2> /dev/null)" ]
then
echo -e "${RED}\n Unable to copy ansi_shadow.flf to /usr/share/figlet${WHI}"
echo -e "${RED} Installation failed.\n${WHI}"
exit
fi
fi
else
echo -e "${GRE}Step 5. - Font file is already installed. Continuing...${WHI}"
fi
#----------
echo -e "${GRE}Step 6. - Preloading dxcc, grid, and license caches...${WHI}"
if [ -f ./.lastqso-dxcc-cache ]
then
rm /tmp/lastqso-dxcc-cache* 2>/dev/null
cp ./.lastqso-dxcc-cache /home/pi-star
fi
if [ -f ./.lastqso-grid-cache ]
then
rm /tmp/lastqso-grid-cache* 2>/dev/null
cp ./.lastqso-grid-cache /home/pi-star
fi
if [ -f ./.lastqso-license-cache ]
then
rm /tmp/lastqso-license-cache* 2>/dev/null
cp ./.lastqso-license-cache /home/pi-star
fi
#----------
echo "${GRE}Step 7. - Returning rootfs filesystem to read-only...${WHI}"
sync ; sync ; sync
sudo mount -o remount,rw /
#----------
echo -e "${WHI}\nInstallation complete."
tput sgr0