-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathxIPL
More file actions
executable file
·109 lines (91 loc) · 2.67 KB
/
xIPL
File metadata and controls
executable file
·109 lines (91 loc) · 2.67 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
#!/usr/bin/env bash
# Created by: Ohkthx (Schism)
# Purpose of file: This is a wrapper for all functions inside of
# xIPL_extras, that is responsible for keeping that file updated
# with the current release available.
# If a new update is available, this script downloads and launches it.
# Find bugs?
# Notify me on GitHub or Discord.
# Name of the shard to patch for, check out:
# https://github.com/Ohkthx/xIPL/tree/main/shards
# For all valid shard names.
SHARD_NAME="shadowage_reborn"
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# You probably do not need to edit this file beyond this point.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Required file that does all of the IPL tasks.
EXTRAS_FILE="xIPL_extras"
REMOTE_EXTRAS="https://raw.githubusercontent.com/Ohkthx/xIPL/main/$EXTRAS_FILE"
function update_extras {
echo "[--] Updating xIPL Extras."
# Check which package we are using to pull the updates.
local puller_exe=""
if command -v curl &>/dev/null; then
puller_exe="curl"
elif command -v wget &>/dev/null; then
puller_exe="wget"
fi
if [[ "$puller_exe" == "" ]]; then
echo "[!!] Could not resolve download tool, requires 'curl' or 'wget'"
exit 1
fi
# Get the headers of the extras file.
local headers="content-length: 0"
case "$puller_exe" in
curl)
headers=$(curl -sI "$REMOTE_EXTRAS")
;;
wget)
headers=$(wget -q -S -O - "$REMOTE_EXTRAS" 2>&1)
;;
esac
# Extract and clean the content-length of whitespace.
local clength=0
clength=$(echo "$headers" | grep -i content-length | awk -F ': ' '{print $2}')
clength="${clength//[$'\t\r\n ']/}"
# Attempt to get the new extras file.
if [[ "$clength" -gt 256 ]]; then
case "$puller_exe" in
curl)
curl -sO "$REMOTE_EXTRAS"
;;
wget)
wget -q "$REMOTE_EXTRAS"
;;
esac
if [ -f "./$EXTRAS_FILE" ]; then
echo "[++] Updated xIPL Extras."
fi
else
echo "[!!] Could not located remote xIPL Extras file."
fi
}
UPDATE_EXTRAS="true"
# Parse the parameters, specifically for --no-update.
for key in "${@}"; do
if [[ "$key" == "--no-update" ]]; then
UPDATE_EXTRAS="false"
break
elif [[ "$key" == "--help" ]]; then
UPDATE_EXTRAS="false"
break
fi
done
# Update the extras file.
if [[ "$UPDATE_EXTRAS" == "true" ]]; then
update_extras
else
echo "[!!] Skipping xIPL Extras updating."
fi
if [ ! -f "./$EXTRAS_FILE" ]; then
echo "[!!] Unknown error occurred, could not download updated xIPL Extras."
exit
fi
# Source the updated extras, starts the:
# installation, patching, and launching.
. "./$EXTRAS_FILE"
# Add the shard as an argument at the beginning.
args=("--shard" "$SHARD_NAME")
args+=("$@")
# Start the wrapped IPL.
start_ipl "${args[@]}"