-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path85-customize.sh
43 lines (34 loc) · 1.26 KB
/
85-customize.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
# Check prerequisites
if [ ! -e /etc/arcadian-customized ]; then
# Paths to files
BANNER_FILE="/etc/banner"
LOGO_FILE="mylogo.txt"
# Downloads custom logo
wget -O $LOGO_FILE https://raw.githubusercontent.com/ArcCdr/PI5-openwrt/refs/heads/main/mylogo.txt
# Check if the logo file exists
if [ ! -f "$LOGO_FILE" ]; then
echo "Error: Logo file '$LOGO_FILE' does not exist."
exit 1
fi
# Check if the banner file exists
if [ ! -f "$BANNER_FILE" ]; then
echo "Error: Banner file '$BANNER_FILE' does not exist."
exit 1
fi
# Extract everything below the first dashed line
TAIL_CONTENT=$(awk '/^ -----------------------------------------------------/ {found=1} found' "$BANNER_FILE")
# Check if the dashed line was found
if [ -z "$TAIL_CONTENT" ]; then
echo "Error: No dashed line found in the banner file."
exit 1
fi
# Replace the content of the banner with the new logo and the tail content
{
cat "$LOGO_FILE" # Add the new logo
echo "" # Add a blank line
echo "$TAIL_CONTENT" # Keep everything below the old logo
} > "$BANNER_FILE"
echo "Banner updated successfully!"
touch /etc/arcadian-customized
fi
exit 1