mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
Adding modules update menu option
This commit is contained in:
parent
d956d24de9
commit
2d378b4854
@ -15,7 +15,7 @@ BOARD_PATH="${CONFIG_DIR}/board/arpl"
|
|||||||
|
|
||||||
echo "Creating image file"
|
echo "Creating image file"
|
||||||
# Create image zeroed
|
# Create image zeroed
|
||||||
dd if="/dev/zero" of="${IMAGE_FILE}" bs=1M count=350 conv=sync 2>/dev/null
|
dd if="/dev/zero" of="${IMAGE_FILE}" bs=1M count=300 conv=sync 2>/dev/null
|
||||||
# Copy grub stage1 to image
|
# Copy grub stage1 to image
|
||||||
dd if="${BOARD_PATH}/grub.bin" of="${IMAGE_FILE}" conv=notrunc,sync 2>/dev/null
|
dd if="${BOARD_PATH}/grub.bin" of="${IMAGE_FILE}" conv=notrunc,sync 2>/dev/null
|
||||||
# Create partitions on image
|
# Create partitions on image
|
||||||
|
@ -687,7 +687,8 @@ function updateMenu() {
|
|||||||
dialog --backtitle "`backtitle`" --menu "Choose a option" 0 0 0 \
|
dialog --backtitle "`backtitle`" --menu "Choose a option" 0 0 0 \
|
||||||
a "Update arpl" \
|
a "Update arpl" \
|
||||||
d "Update addons" \
|
d "Update addons" \
|
||||||
l "Update Modules/LKMs" \
|
l "Update LKMs" \
|
||||||
|
m "Update modules" \
|
||||||
e "Exit" \
|
e "Exit" \
|
||||||
2>${TMP_PATH}/resp
|
2>${TMP_PATH}/resp
|
||||||
[ $? -ne 0 ] && return
|
[ $? -ne 0 ] && return
|
||||||
@ -768,20 +769,7 @@ function updateMenu() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
l)
|
l)
|
||||||
unset PLATFORMS
|
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||||
declare -A PLATFORMS
|
|
||||||
while read M; do
|
|
||||||
M="`basename ${M}`"
|
|
||||||
MODEL="${M::-4}"
|
|
||||||
PLATFORM=`readModelKey "${MODEL}" "platform"`
|
|
||||||
ITEMS="`readConfigEntriesArray "builds" "${MODEL_CONFIG_PATH}/${MODEL}.yml"`"
|
|
||||||
for BUILD in ${ITEMS}; do
|
|
||||||
KVER=`readModelKey "${MODEL}" "builds.${BUILD}.kver"`
|
|
||||||
PLATFORMS["${PLATFORM}-${KVER}"]=""
|
|
||||||
done
|
|
||||||
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sort)
|
|
||||||
|
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
|
||||||
--infobox "Checking last version" 0 0
|
--infobox "Checking last version" 0 0
|
||||||
TAG=`curl --insecure -s https://api.github.com/repos/fbelavenuto/redpill-lkm/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
TAG=`curl --insecure -s https://api.github.com/repos/fbelavenuto/redpill-lkm/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||||
if [ $? -ne 0 -o -z "${TAG}" ]; then
|
if [ $? -ne 0 -o -z "${TAG}" ]; then
|
||||||
@ -789,32 +777,57 @@ function updateMenu() {
|
|||||||
--msgbox "Error checking new version" 0 0
|
--msgbox "Error checking new version" 0 0
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||||
--infobox "Downloading last version" 0 0
|
--infobox "Downloading last version" 0 0
|
||||||
curl --insecure -s -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
curl --insecure -s -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||||
--msgbox "Error downloading last version" 0 0
|
--msgbox "Error downloading last version" 0 0
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||||
|
--infobox "Extracting last version" 0 0
|
||||||
|
rm -rf "${LKM_PATH}/"*
|
||||||
|
unzip /tmp/rp-lkms.zip -d "${LKM_PATH}" >/dev/null 2>&1
|
||||||
|
dialog --backtitle "`backtitle`" --title "Update LKMs" --aspect 18 \
|
||||||
|
--msgbox "LKMs updated with success!" 0 0
|
||||||
|
;;
|
||||||
|
m)
|
||||||
|
unset PLATFORMS
|
||||||
|
declare -A PLATFORMS
|
||||||
|
while read M; do
|
||||||
|
M="`basename ${M}`"
|
||||||
|
M="${M::-4}"
|
||||||
|
P=`readModelKey "${M}" "platform"`
|
||||||
|
ITEMS="`readConfigEntriesArray "builds" "${MODEL_CONFIG_PATH}/${M}.yml"`"
|
||||||
|
for B in ${ITEMS}; do
|
||||||
|
KVER=`readModelKey "${M}" "builds.${B}.kver"`
|
||||||
|
PLATFORMS["${P}-${KVER}"]=""
|
||||||
|
done
|
||||||
|
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sort)
|
||||||
|
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||||
|
--infobox "Checking last version" 0 0
|
||||||
|
TAG=`curl --insecure -s https://api.github.com/repos/fbelavenuto/arpl-modules/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||||
|
if [ $? -ne 0 -o -z "${TAG}" ]; then
|
||||||
|
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||||
|
--msgbox "Error checking new version" 0 0
|
||||||
|
continue
|
||||||
|
fi
|
||||||
for P in ${!PLATFORMS[@]}; do
|
for P in ${!PLATFORMS[@]}; do
|
||||||
curl --insecure -s -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/${P}.tgz" -o "/tmp/${P}.tgz"
|
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||||
|
--infobox "Downloading ${P} modules" 0 0
|
||||||
|
curl --insecure -s -L "https://github.com/fbelavenuto/arpl-modules/releases/download/${TAG}/${P}.tgz" -o "/tmp/${P}.tgz"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||||
--msgbox "Error downloading ${P}.tgz" 0 0
|
--msgbox "Error downloading ${P}.tgz" 0 0
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
rm "${MODULES_PATH}/${P}.tgz"
|
rm "${MODULES_PATH}/${P}.tgz"
|
||||||
mv "/tmp/${P}.tgz" "${MODULES_PATH}/${P}.tgz"
|
mv "/tmp/${P}.tgz" "${MODULES_PATH}/${P}.tgz"
|
||||||
done
|
done
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
dialog --backtitle "`backtitle`" --title "Update Modules" --aspect 18 \
|
||||||
--infobox "Extracting last version" 0 0
|
--msgbox "Modules updated with success!" 0 0
|
||||||
rm -rf "${LKM_PATH}/"*
|
|
||||||
unzip /tmp/rp-lkms.zip -d "${LKM_PATH}" >/dev/null 2>&1
|
|
||||||
dialog --backtitle "`backtitle`" --title "Update Modules/LKMs" --aspect 18 \
|
|
||||||
--msgbox "LKMs updated with success!" 0 0
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
e) return ;;
|
e) return ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user