-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgitcopy32.sh
More file actions
executable file
·130 lines (97 loc) · 3.11 KB
/
Copy pathgitcopy32.sh
File metadata and controls
executable file
·130 lines (97 loc) · 3.11 KB
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
#!/bin/bash
#########################################################
# Nextion TFT Support for Nextion 3.2" #
# Gets all Scripts and support files from github #
# and copies them into the Nextion_Support directory "
# and copies the NX??? tft file into /usr/local/etc #
# and returns a script duration time to the Screen #
# as a script completion flag #
# #
# KF6S/VE3RD 2024-12-21 #
#########################################################
p1=$(pwd) ; cd .. ; homedir=$(pwd) ; cd "$p1"
who=$(whoami)
echo "This script is running as $who user"
sleep 2
run=""
errtext="This is a test"
export NCURSES_NO_UTF8_ACS=1
export LANG=en_US.UTF-8
if [ ! -f ~/.dialog ]; then
# j=1
# else
sudo dialog --create-rc ~/.dialogrc
fi
sudo sed -i '/use_colors = /c\use_colors = ON' ~/.dialogrc
sudo sed -i '/screen_color = /c\screen_color = (WHITE,BLUE,ON)' ~/.dialogrc
sudo sed -i '/title_color = /c\title_color = (YELLOW,RED,ON)' ~/.dialogrc
echo -e '\e[1;44m'
function exitcode
{
txt='Abort Function\n\n
This Script will Now Stop'"\n$errtext"
dialog --title " Programmed Exit " --ascii-lines --msgbox "$txt" 8 78
clear
echo -e '\e[1;40m'
run="Done"
exit
}
# VE3ZRD Script Function
function getve3zrd
{
if [ -d /home/pi-star/Nextion_Temp ]; then
sudo rm -R /home/pi-star/Nextion_Temp
fi
echo "Remove /home/pi-star/Nextion_Temp"
if [ -d /usr/local/etc/Nextion_Support ]; then
sudo rm /usr/local/etc/Nextion_Support/*
else
sudo mkdir /usr/local/etc/Nextion_Support
fi
echo "Remove files from /usr/local/etc/Nextion_Support"
if [ -f /usr/local/etc/*.tft ]; then
sudo rm /usr/local/etc/*.tft
fi
echo "Deleting old tft file"
echo "Getting Github repository: https://github.com/TGIF-Network/NX4024K032"
sudo git clone --depth 1 https://github.com/TGIF-Network/NX4024K032 /home/pi-star/Nextion_Temp
rsync /home/pi-star/Nextion_Temp/* /usr/local/etc/Nextion_Support/*
cp /home/pi-star/Nextion_Temp/NX* /usr/local/etc/
}
#### Start of Main Code
#Start Duration Timer
start=$(date +%s.%N)
model="$scn"
tft='.tft'
#gz='.gz'
#Put Pi-Star file system in RW mode
sudo mount -o remount,rw / > /dev/null
sleep 1s
getve3zrd
#Stop the cron service
sudo systemctl stop cron.service > /dev/null
sudo chmod +x "$homedir"/Nextion_Temp/*.sh
sudo rsync -avqru "$homedir"/Scripts/stripped2.csv /usr/local/etc/
sudo mount -o remount,rw /
sudo wget https://database.radioid.net/static/user.csv -O /usr/local/etc/stripped.csv
if [ ! -f "/etc/Colors.ini" ]; then
cp /home/pi-star/Nextion_Support/Colors.ini /etc/
fi
FILE="/usr/local/etc/*.tft"
if [ ! -f /usr/local/etc/*.tft ]; then
# Copy failed
echo "No TFT File Available to Flash - Try Again"
errtext="Missing tft File Parameter"
exitcode
fi
sudo systemctl start cron.service > /dev/null
duration=$(echo "$(date +%s.%N) - $start" | bc)
execution_time=`printf "%.2f seconds" $duration`
txt="$calltxt Scripts Loaded: $execution_time"
#whiptail --title "$title" --msgbox "$txt" 8 90
dialog --title " $title " --ascii-lines --msgbox "$txt" 8 78
echo -e '\e[1;40m'
if [ -z "$1" ]; then
clear
fi
sudo mount -o remount,ro /