mirror of
https://github.com/RROrg/rr.git
synced 2025-09-25 13:17:04 +08:00
优化脚本,简化条件判断,移除不必要的 LOCALBUILD 检查
This commit is contained in:
parent
0c77bada57
commit
3ad6ba68a6
31
.github/workflows/data.yml
vendored
31
.github/workflows/data.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
echo "Delaying for 1 minutes..."
|
echo "Delaying for 1 minutes..."
|
||||||
sleep 60
|
sleep 60
|
||||||
|
|
||||||
- name: Get Release RR
|
- name: Get Data
|
||||||
run: |
|
run: |
|
||||||
REPO="${{ github.server_url }}/${{ github.repository }}"
|
REPO="${{ github.server_url }}/${{ github.repository }}"
|
||||||
PRERELEASE="true"
|
PRERELEASE="true"
|
||||||
@ -57,18 +57,17 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unzip rr-${TAG}.img.zip -d "rr"
|
unzip rr-${TAG}.img.zip -d rr rr.img
|
||||||
|
|
||||||
export TERM=xterm
|
. scripts/func.sh "${{ secrets.RRORG }}"
|
||||||
|
|
||||||
sudo ./localbuild.sh create rr/ws rr/rr.img
|
LOOPX=$(sudo losetup -f)
|
||||||
if [ $? -ne 0 ]; then
|
sudo losetup -P "${LOOPX}" "rr/rr.img"
|
||||||
echo "create failed"
|
rm -rf "/tmp/mnt/p3"
|
||||||
exit 1
|
mkdir -p "/tmp/mnt/p3"
|
||||||
fi
|
mount "${LOOPX}p3" "/tmp/mnt/p3"
|
||||||
|
unpackInitrd /tmp/mnt/p3/initrd-rr "rr/initrd"
|
||||||
|
|
||||||
- name: Get data
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
|
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
|
||||||
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
||||||
@ -78,10 +77,14 @@ jobs:
|
|||||||
sudo mv -f "$(realpath $(which python3))/EXTERNALLY-MANAGED" "$(realpath $(which python3))/EXTERNALLY-MANAGED.bak" 2>/dev/null || true
|
sudo mv -f "$(realpath $(which python3))/EXTERNALLY-MANAGED" "$(realpath $(which python3))/EXTERNALLY-MANAGED.bak" 2>/dev/null || true
|
||||||
sudo pip3 install -U -r scripts/requirements.txt
|
sudo pip3 install -U -r scripts/requirements.txt
|
||||||
|
|
||||||
python3 scripts/func.py getmodels -w "rr/ws/initrd" -j "docs/models.json" -x "docs/models.xlsx"
|
python3 scripts/func.py getmodels -w "rr/initrd" -j "docs/models.json" -x "docs/models.xlsx"
|
||||||
python3 scripts/func.py getpats -w "rr/ws/initrd" -j "docs/pats.json" -x "docs/pats.xlsx"
|
python3 scripts/func.py getpats -w "rr/initrd" -j "docs/pats.json" -x "docs/pats.xlsx"
|
||||||
python3 scripts/func.py getaddons -w "rr/ws" -j "docs/addons.json" -x "docs/addons.xlsx"
|
python3 scripts/func.py getaddons -w "/tmp" -j "docs/addons.json" -x "docs/addons.xlsx"
|
||||||
python3 scripts/func.py getmodules -w "rr/ws" -j "docs/modules.json" -x "docs/modules.xlsx"
|
python3 scripts/func.py getmodules -w "/tmp" -j "docs/modules.json" -x "docs/modules.xlsx"
|
||||||
|
|
||||||
|
sudo umount "/tmp/mnt/p3"
|
||||||
|
sudo losetup -d "${LOOPX}"
|
||||||
|
rm -rf "/tmp/mnt/p3"
|
||||||
|
|
||||||
- name: Upload to Artifacts
|
- name: Upload to Artifacts
|
||||||
if: success()
|
if: success()
|
||||||
|
@ -363,7 +363,7 @@ if [ "${DIRECT}" = "true" ] || [ "${MEV:-physical}" = "parallels" ]; then
|
|||||||
_bootwait || exit 0
|
_bootwait || exit 0
|
||||||
|
|
||||||
printf "\033[1;33m%s\033[0m\n" "$(TEXT "Reboot to boot directly in DSM")"
|
printf "\033[1;33m%s\033[0m\n" "$(TEXT "Reboot to boot directly in DSM")"
|
||||||
[ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ] && reboot
|
[ ! -f "/.dockerenv" ] && reboot
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
rm -f "${USER_RSYSENVFILE}" 2>/dev/null || true
|
rm -f "${USER_RSYSENVFILE}" 2>/dev/null || true
|
||||||
@ -390,7 +390,7 @@ else
|
|||||||
printf "."
|
printf "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
if [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ ! -f "/.dockerenv" ]; then
|
||||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
printf "$(TEXT "Waiting IP.\n")"
|
printf "$(TEXT "Waiting IP.\n")"
|
||||||
@ -464,7 +464,7 @@ else
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ ! -f "/.dockerenv" ]; then
|
||||||
# Disconnect wireless
|
# Disconnect wireless
|
||||||
lsmod | grep -q iwlwifi && for F in /sys/class/net/wlan*; do
|
lsmod | grep -q iwlwifi && for F in /sys/class/net/wlan*; do
|
||||||
[ ! -e "${F}" ] && continue
|
[ ! -e "${F}" ] && continue
|
||||||
|
@ -94,7 +94,7 @@ fi
|
|||||||
initConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
initConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||||
initConfigKey "modblacklist" "evbug,cdc_ether" "${USER_CONFIG_FILE}"
|
initConfigKey "modblacklist" "evbug,cdc_ether" "${USER_CONFIG_FILE}"
|
||||||
|
|
||||||
if [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ ! -f "/.dockerenv" ]; then
|
||||||
if arrayExistItem "sortnetif:" "$(readConfigMap "addons" "${USER_CONFIG_FILE}")"; then
|
if arrayExistItem "sortnetif:" "$(readConfigMap "addons" "${USER_CONFIG_FILE}")"; then
|
||||||
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
|
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
|
||||||
fi
|
fi
|
||||||
@ -138,13 +138,8 @@ if [ "${BUS}" = "usb" ]; then
|
|||||||
elif [ "${BUS}" = "docker" ]; then
|
elif [ "${BUS}" = "docker" ]; then
|
||||||
TYPE="PC"
|
TYPE="PC"
|
||||||
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
||||||
if [ "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
|
||||||
echo "LOCALBUILD MODE"
|
|
||||||
TYPE="PC"
|
|
||||||
else
|
|
||||||
die "$(printf "$(TEXT "The loader disk does not support the current %s, only %s DoM is supported.")" "${BUS}" "${BUSLIST// /\/}")"
|
die "$(printf "$(TEXT "The loader disk does not support the current %s, only %s DoM is supported.")" "${BUS}" "${BUSLIST// /\/}")"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Save variables to user config file
|
# Save variables to user config file
|
||||||
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
|
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
|
||||||
@ -205,7 +200,7 @@ while [ ${COUNT} -lt 30 ]; do
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ ! -f "/.dockerenv" ]; then
|
||||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -262,7 +257,7 @@ fi
|
|||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
||||||
DSMLOGO="$(readConfigKey "dsmlogo" "${USER_CONFIG_FILE}")"
|
DSMLOGO="$(readConfigKey "dsmlogo" "${USER_CONFIG_FILE}")"
|
||||||
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ] && [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ] && [ ! -f "/.dockerenv" ]; then
|
||||||
IP="$(getIP)"
|
IP="$(getIP)"
|
||||||
echo "${IP}" | grep -q "^169\.254\." && IP=""
|
echo "${IP}" | grep -q "^169\.254\." && IP=""
|
||||||
[ -n "${IP}" ] && URL="http://${IP}:${TTYD:-7681}" || URL="http://rr:${TTYD:-7681}"
|
[ -n "${IP}" ] && URL="http://${IP}:${TTYD:-7681}" || URL="http://rr:${TTYD:-7681}"
|
||||||
@ -273,7 +268,7 @@ if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ] && [ ! -f "/.dockerenv" ] && [
|
|||||||
[ -f "${TMP_PATH}/qrcode_qhxg.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_qhxg.png" >/dev/null 2>&1 || true
|
[ -f "${TMP_PATH}/qrcode_qhxg.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_qhxg.png" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
WEBHOOKURL="$(readConfigKey "webhookurl" "${USER_CONFIG_FILE}")"
|
WEBHOOKURL="$(readConfigKey "webhookurl" "${USER_CONFIG_FILE}")"
|
||||||
if [ -n "${WEBHOOKURL}" ] && [ ! -f "${TMP_PATH}/WebhookSent" ] && [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ -n "${WEBHOOKURL}" ] && [ ! -f "${TMP_PATH}/WebhookSent" ] && [ ! -f "/.dockerenv" ]; then
|
||||||
DMI="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
|
DMI="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
|
||||||
IP="$(getIP)"
|
IP="$(getIP)"
|
||||||
echo "${IP}" | grep -q "^169\.254\." && IP=""
|
echo "${IP}" | grep -q "^169\.254\." && IP=""
|
||||||
|
@ -130,9 +130,6 @@ fi
|
|||||||
# Mounts backtitle dynamically
|
# Mounts backtitle dynamically
|
||||||
function backtitle() {
|
function backtitle() {
|
||||||
BACKTITLE=""
|
BACKTITLE=""
|
||||||
if [ "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
|
||||||
BACKTITLE="LOCAL "
|
|
||||||
fi
|
|
||||||
BACKTITLE+="${RR_TITLE}${RR_RELEASE:+(${RR_RELEASE})}"
|
BACKTITLE+="${RR_TITLE}${RR_RELEASE:+(${RR_RELEASE})}"
|
||||||
if [ -n "${MODEL}" ]; then
|
if [ -n "${MODEL}" ]; then
|
||||||
BACKTITLE+=" ${MODEL}(${PLATFORM})"
|
BACKTITLE+=" ${MODEL}(${PLATFORM})"
|
||||||
@ -3146,7 +3143,6 @@ function advancedMenu() {
|
|||||||
if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ]; then
|
if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ]; then
|
||||||
echo "b \"$(TEXT "Use EMMC as the system disk:") \Z4${EMMCBOOT}\Zn\""
|
echo "b \"$(TEXT "Use EMMC as the system disk:") \Z4${EMMCBOOT}\Zn\""
|
||||||
fi
|
fi
|
||||||
if [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
|
||||||
echo "s \"$(TEXT "Show disks information")\""
|
echo "s \"$(TEXT "Show disks information")\""
|
||||||
echo "t \"$(TEXT "Mounting DSM storage pool")\""
|
echo "t \"$(TEXT "Mounting DSM storage pool")\""
|
||||||
echo "f \"$(TEXT "Format disk(s) # Without loader disk")\""
|
echo "f \"$(TEXT "Format disk(s) # Without loader disk")\""
|
||||||
@ -3158,7 +3154,6 @@ function advancedMenu() {
|
|||||||
echo "o \"$(TEXT "Remove the blocked IP database of DSM")\""
|
echo "o \"$(TEXT "Remove the blocked IP database of DSM")\""
|
||||||
echo "q \"$(TEXT "Disable all scheduled tasks of DSM")\""
|
echo "q \"$(TEXT "Disable all scheduled tasks of DSM")\""
|
||||||
echo "r \"$(TEXT "Initialize DSM network settings")\""
|
echo "r \"$(TEXT "Initialize DSM network settings")\""
|
||||||
fi
|
|
||||||
echo "e \"$(TEXT "Exit")\""
|
echo "e \"$(TEXT "Exit")\""
|
||||||
} >"${TMP_PATH}/menu"
|
} >"${TMP_PATH}/menu"
|
||||||
|
|
||||||
@ -3394,7 +3389,6 @@ function settingsMenu() {
|
|||||||
echo "p \"$(TEXT "Custom patch script # Developer")\""
|
echo "p \"$(TEXT "Custom patch script # Developer")\""
|
||||||
echo "u \"$(TEXT "Edit user config file manually")\""
|
echo "u \"$(TEXT "Edit user config file manually")\""
|
||||||
echo "g \"$(TEXT "Edit grub.cfg file manually")\""
|
echo "g \"$(TEXT "Edit grub.cfg file manually")\""
|
||||||
if [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
|
||||||
echo "r \"$(TEXT "Try to recovery a installed DSM system")\""
|
echo "r \"$(TEXT "Try to recovery a installed DSM system")\""
|
||||||
echo "c \"$(TEXT "Clone bootloader disk to another disk")\""
|
echo "c \"$(TEXT "Clone bootloader disk to another disk")\""
|
||||||
echo "q \"$(TEXT "System Environment Report")\""
|
echo "q \"$(TEXT "System Environment Report")\""
|
||||||
@ -3403,7 +3397,6 @@ function settingsMenu() {
|
|||||||
echo "s \"$(TEXT "Save modifications of '/opt/rr'")\""
|
echo "s \"$(TEXT "Save modifications of '/opt/rr'")\""
|
||||||
echo "i \"$(TEXT "Set static IP")\""
|
echo "i \"$(TEXT "Set static IP")\""
|
||||||
echo "w \"$(TEXT "Set wireless account")\""
|
echo "w \"$(TEXT "Set wireless account")\""
|
||||||
fi
|
|
||||||
echo "1 \"$(TEXT "Set global proxy")\""
|
echo "1 \"$(TEXT "Set global proxy")\""
|
||||||
echo "2 \"$(TEXT "Set github proxy")\""
|
echo "2 \"$(TEXT "Set github proxy")\""
|
||||||
UPDMC="$([ -f "${MC_RAMDISK_FILE}" ] && echo "true" || echo "false")"
|
UPDMC="$([ -f "${MC_RAMDISK_FILE}" ] && echo "true" || echo "false")"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user