mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 23:59:53 +07:00
update: add custom to update section
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
48c66303af
commit
74e7294491
@ -831,6 +831,7 @@ function updateMenu() {
|
||||
6 "Update LKMs" \
|
||||
7 "Update Modules" \
|
||||
8 "Update Patches" \
|
||||
9 "Update Custom Kernel" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
case "$(cat ${TMP_PATH}/resp)" in
|
||||
@ -1006,6 +1007,29 @@ function updateMenu() {
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
;;
|
||||
9)
|
||||
# Ask for Tag
|
||||
TAG=""
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Update Custom Kernel" \
|
||||
--menu "Which Version?" 0 0 0 \
|
||||
1 "Latest" \
|
||||
2 "Select Version" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
[ -z "${opts}" ] && return 1
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
TAG=""
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
|
||||
--inputbox "Type the Version!" 0 0 \
|
||||
2>"${TMP_PATH}/input"
|
||||
TAG=$(cat "${TMP_PATH}/input")
|
||||
[ -z "${TAG}" ] && return 1
|
||||
fi
|
||||
updateCustom "${TAG}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return
|
||||
|
@ -299,6 +299,69 @@ function updatePatches() {
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Update Custom
|
||||
function updateCustom() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/checksum.sha256"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "Download: $progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "Download: $progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
if [ "$(sha256sum "${TMP_PATH}/custom.zip" | awk '{print $1}')" = "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${CUSTOM_PATH}"
|
||||
mkdir -p "${CUSTOM_PATH}"
|
||||
echo "Installing new Custom Kernel..."
|
||||
unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"
|
||||
rm -f "${TMP_PATH}/custom.zip"
|
||||
else
|
||||
echo "Error extracting new Version!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Custom" \
|
||||
--progressbox "Updating Custom..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Update Modules
|
||||
function updateModules() {
|
||||
|
@ -69,6 +69,7 @@ function arcUpdate() {
|
||||
updateLKMs
|
||||
updateModules
|
||||
updatePatches
|
||||
updateCustom
|
||||
# Ask for Boot
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update successful!" 0 0
|
||||
|
Loading…
Reference in New Issue
Block a user