mirror of
https://github.com/RROrg/rr.git
synced 2026-01-14 23:39:33 +08:00
Compare commits
5 Commits
32cfc2b257
...
51974dd95c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51974dd95c | ||
|
|
2f02843dff | ||
|
|
38caa773d7 | ||
|
|
59112312c6 | ||
|
|
9710c33f35 |
89
.github/workflows/issues.yml
vendored
89
.github/workflows/issues.yml
vendored
@ -27,68 +27,51 @@ jobs:
|
|||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import json, subprocess
|
import json
|
||||||
def set_output(name, value):
|
import os
|
||||||
subprocess.call(f'echo "{name}<<EOF" >> $GITHUB_ENV', shell=True)
|
|
||||||
subprocess.call(f'echo "{value}" >> $GITHUB_ENV', shell=True)
|
|
||||||
subprocess.call(f'echo "EOF" >> $GITHUB_ENV', shell=True)
|
|
||||||
|
|
||||||
issuetitle = ${{ toJSON(github.event.issue.title) }}
|
def set_env(name, value):
|
||||||
issuebody = ${{ toJSON(github.event.issue.body) }}
|
with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as f:
|
||||||
|
f.write(f'{name}={value}\n')
|
||||||
|
|
||||||
|
issuetitle = """${{ github.event.issue.title }}"""
|
||||||
|
issuebody = """${{ github.event.issue.body }}"""
|
||||||
|
|
||||||
iscustom = 'false'
|
iscustom = 'false'
|
||||||
warinfo = 'false'
|
warinfo = 'false'
|
||||||
|
|
||||||
format = ''
|
fields = {
|
||||||
size = ''
|
"format": "",
|
||||||
template = ''
|
"size": "",
|
||||||
language= ''
|
"template": "",
|
||||||
sn = ''
|
"language": "",
|
||||||
macs = ''
|
"sn": "",
|
||||||
tips = ''
|
"macs": "",
|
||||||
model = ''
|
"tips": "",
|
||||||
version = ''
|
"model": "",
|
||||||
kernel = ''
|
"version": "",
|
||||||
addons = ''
|
"kernel": "",
|
||||||
modules = ''
|
"addons": "",
|
||||||
|
"modules": ""
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if issuetitle.lower().startswith('custom'):
|
if issuetitle.strip().lower().startswith('custom'):
|
||||||
jsonbody = json.loads(issuebody)
|
jsonbody = json.loads(issuebody)
|
||||||
iscustom = 'true'
|
iscustom = 'true'
|
||||||
format = jsonbody.get('format', '')
|
for k in fields:
|
||||||
size = jsonbody.get('size', '')
|
fields[k] = jsonbody.get(k, "")
|
||||||
template = jsonbody.get('template', '')
|
except Exception:
|
||||||
language = jsonbody.get('language', '')
|
pass
|
||||||
sn = jsonbody.get('sn', '')
|
|
||||||
macs = jsonbody.get('macs', '')
|
|
||||||
tips = jsonbody.get('tips', '')
|
|
||||||
model = jsonbody.get('model', '')
|
|
||||||
version = jsonbody.get('version', '')
|
|
||||||
kernel = jsonbody.get('kernel', '')
|
|
||||||
addons = jsonbody.get('addons', '')
|
|
||||||
modules = jsonbody.get('modules', '')
|
|
||||||
except ValueError as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if iscustom == 'false':
|
if iscustom == 'false':
|
||||||
if issuebody.find('DMI') < 0 and issuebody.find('CPU') < 0 and issuebody.find('NIC') < 0:
|
if not any(x in issuebody for x in ['DMI', 'CPU', 'NIC']):
|
||||||
warinfo = 'true'
|
warinfo = 'true'
|
||||||
|
|
||||||
set_output("iscustom", iscustom)
|
set_env("iscustom", iscustom)
|
||||||
set_output("warinfo", warinfo)
|
set_env("warinfo", warinfo)
|
||||||
|
for k, v in fields.items():
|
||||||
set_output("format", format)
|
set_env(k, v)
|
||||||
set_output("size", size)
|
|
||||||
set_output("template", template)
|
|
||||||
set_output("language", language)
|
|
||||||
set_output("sn", sn)
|
|
||||||
set_output("macs", macs)
|
|
||||||
set_output("tips", tips)
|
|
||||||
set_output("model", model)
|
|
||||||
set_output("version", version)
|
|
||||||
set_output("kernel", kernel)
|
|
||||||
set_output("addons", addons)
|
|
||||||
set_output("modules", modules)
|
|
||||||
|
|
||||||
- name: Update Comment Warinfo
|
- name: Update Comment Warinfo
|
||||||
if: env.warinfo == 'true'
|
if: env.warinfo == 'true'
|
||||||
|
|||||||
@ -112,7 +112,7 @@ printf "%s \033[1;36m%s\033[0m\n" "$(TEXT "MEM: ")" "${MEM}"
|
|||||||
|
|
||||||
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
|
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
|
||||||
HASATA=0
|
HASATA=0
|
||||||
for D in $(lsblk -dpno NAME); do
|
for D in $(lsblk -dpno KNAME); do
|
||||||
[ "${D}" = "${LOADER_DISK}" ] && continue
|
[ "${D}" = "${LOADER_DISK}" ] && continue
|
||||||
if echo "sata sas scsi" | grep -wq "$(getBus "${D}")"; then
|
if echo "sata sas scsi" | grep -wq "$(getBus "${D}")"; then
|
||||||
HASATA=1
|
HASATA=1
|
||||||
|
|||||||
34
files/initrd/opt/rr/helper.sh
Normal file
34
files/initrd/opt/rr/helper.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022 Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# shellcheck disable=SC2059
|
||||||
|
|
||||||
|
[ -z "${WORK_PATH}" ] || [ ! -d "${WORK_PATH}/include" ] && WORK_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||||
|
|
||||||
|
. "${WORK_PATH}/include/functions.sh"
|
||||||
|
|
||||||
|
# lock
|
||||||
|
exec 911>"${TMP_PATH}/helper.lock"
|
||||||
|
flock -n 911 || {
|
||||||
|
MSG="$(TEXT "Another instance is already running.")"
|
||||||
|
dialog --colors --aspect 50 --title "$(TEXT "Online Assistance")" --msgbox "${MSG}" 0 0
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
trap 'flock -u 911; rm -f "${TMP_PATH}/helper.lock"' EXIT INT TERM HUP
|
||||||
|
|
||||||
|
{
|
||||||
|
printf "$(TEXT "Closing this window or press 'ctrl + c' to exit the assistance.")\n"
|
||||||
|
printf "$(TEXT "Please give the following link to the helper. (Click to open and copy)")\n"
|
||||||
|
printf " 👇\n"
|
||||||
|
sshx -q --name "RR-Helper" 2>&1
|
||||||
|
[ $? -ne 0 ] && while true; do sleep 1; done
|
||||||
|
} | dialog --colors --aspect 50 --title "$(TEXT "Online Assistance")" --progressbox "$(TEXT "Notice: Please keep this window open.")" 20 100 2>&1
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo -e "$(TEXT "Call \033[1;32mmenu.sh\033[0m to return to menu")"
|
||||||
|
"${WORK_PATH}/init.sh"
|
||||||
@ -246,6 +246,7 @@ function _sort_netif() {
|
|||||||
ETHLIST=""
|
ETHLIST=""
|
||||||
for F in /sys/class/net/eth*; do
|
for F in /sys/class/net/eth*; do
|
||||||
[ ! -e "${F}" ] && continue
|
[ ! -e "${F}" ] && continue
|
||||||
|
local ETH MAC BUS
|
||||||
ETH="$(basename "${F}")"
|
ETH="$(basename "${F}")"
|
||||||
MAC="$(cat "/sys/class/net/${ETH}/address" 2>/dev/null | sed 's/://g; s/.*/\L&/')"
|
MAC="$(cat "/sys/class/net/${ETH}/address" 2>/dev/null | sed 's/://g; s/.*/\L&/')"
|
||||||
BUS="$(ethtool -i "${ETH}" 2>/dev/null | grep bus-info | cut -d' ' -f2)"
|
BUS="$(ethtool -i "${ETH}" 2>/dev/null | grep bus-info | cut -d' ' -f2)"
|
||||||
@ -288,10 +289,11 @@ function _sort_netif() {
|
|||||||
# 1 - device path
|
# 1 - device path
|
||||||
function getBus() {
|
function getBus() {
|
||||||
local BUS=""
|
local BUS=""
|
||||||
|
[ -f "/.dockerenv" ] && BUS="docker"
|
||||||
# usb/ata(ide)/sata/sas/spi(scsi)/virtio/mmc/nvme
|
# usb/ata(ide)/sata/sas/spi(scsi)/virtio/mmc/nvme
|
||||||
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}' | sed 's/^ata$/ide/' | sed 's/^spi$/scsi/') #Spaces are intentional
|
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}' | sed 's/^ata$/ide/' | sed 's/^spi$/scsi/') #Spaces are intentional
|
||||||
# usb/scsi(ide/sata/sas)/virtio/mmc/nvme/vmbus/xen(xvd)
|
# usb/scsi(ide/sata/sas)/virtio/mmc/nvme/vmbus/xen(xvd)
|
||||||
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//' | sed 's/^.*xen.*$/xen/') # Spaces are intentional
|
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{split($2,a,":"); if(length(a)>1) print a[length(a)-1]}' | sed 's/_host//' | sed 's/^.*xen.*$/xen/') # Spaces are intentional
|
||||||
[ -z "${BUS}" ] && BUS="unknown"
|
[ -z "${BUS}" ] && BUS="unknown"
|
||||||
echo "${BUS}"
|
echo "${BUS}"
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -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 [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ ! -f "/.dockerenv" ] && [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; 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
|
||||||
@ -129,12 +129,14 @@ PID="0x0001"
|
|||||||
TYPE="DoM"
|
TYPE="DoM"
|
||||||
BUS=$(getBus "${LOADER_DISK}")
|
BUS=$(getBus "${LOADER_DISK}")
|
||||||
|
|
||||||
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen"
|
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen docker"
|
||||||
if [ "${BUS}" = "usb" ]; then
|
if [ "${BUS}" = "usb" ]; then
|
||||||
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" 2>/dev/null | grep "ID_VENDOR_ID" | cut -d= -f2)"
|
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" 2>/dev/null | grep "ID_VENDOR_ID" | cut -d= -f2)"
|
||||||
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" 2>/dev/null | grep "ID_MODEL_ID" | cut -d= -f2)"
|
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" 2>/dev/null | grep "ID_MODEL_ID" | cut -d= -f2)"
|
||||||
[ "${VID}" = "0x" ] || [ "${PID}" = "0x" ] && die "$(TEXT "The loader disk does not support the current USB Portable Hard Disk.")"
|
[ "${VID}" = "0x" ] || [ "${PID}" = "0x" ] && die "$(TEXT "The loader disk does not support the current USB Portable Hard Disk.")"
|
||||||
TYPE="flashdisk"
|
TYPE="flashdisk"
|
||||||
|
elif [ "${BUS}" = "docker" ]; then
|
||||||
|
TYPE="PC"
|
||||||
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
||||||
if [ "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
if [ "LOCALBUILD" = "${LOADER_DISK}" ]; then
|
||||||
echo "LOCALBUILD MODE"
|
echo "LOCALBUILD MODE"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,11 @@ flock -n 304 || {
|
|||||||
dialog --colors --aspect 50 --title "$(TEXT "Error")" --msgbox "${MSG}" 0 0
|
dialog --colors --aspect 50 --title "$(TEXT "Error")" --msgbox "${MSG}" 0 0
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
trap 'flock -u 304; rm -f "${TMP_PATH}/menu.lock"' EXIT INT TERM HUP
|
cleanup_lock() {
|
||||||
|
flock -u 304
|
||||||
|
rm -f "${TMP_PATH}/menu.lock"
|
||||||
|
}
|
||||||
|
trap 'cleanup_lock' EXIT INT TERM HUP
|
||||||
|
|
||||||
# Check partition 3 space, if < 2GiB is necessary clean cache folder
|
# Check partition 3 space, if < 2GiB is necessary clean cache folder
|
||||||
SPACELEFT=$(df -m "${PART3_PATH}" 2>/dev/null | awk 'NR==2 {print $4}')
|
SPACELEFT=$(df -m "${PART3_PATH}" 2>/dev/null | awk 'NR==2 {print $4}')
|
||||||
@ -2137,10 +2141,17 @@ function initDSMNetwork {
|
|||||||
[ $? -ne 0 ] && continue
|
[ $? -ne 0 ] && continue
|
||||||
for F in ${TMP_PATH}/mdX/etc/sysconfig/network-scripts/ifcfg-* ${TMP_PATH}/mdX/etc.defaults/sysconfig/network-scripts/ifcfg-*; do
|
for F in ${TMP_PATH}/mdX/etc/sysconfig/network-scripts/ifcfg-* ${TMP_PATH}/mdX/etc.defaults/sysconfig/network-scripts/ifcfg-*; do
|
||||||
[ ! -e "${F}" ] && continue
|
[ ! -e "${F}" ] && continue
|
||||||
case "${F}" in
|
ETHX=$(echo "${F}" | sed -E 's/.*ifcfg-(.*)$/\1/')
|
||||||
*ovs_* | *-bond*) rm -f "${F}" ;;
|
case "${ETHX}" in
|
||||||
*-eth*)
|
ovs_bond*)
|
||||||
ETHX=$(echo "${F}" | sed -E 's/.*ifcfg-(eth[0-9]+)$/\1/')
|
rm -f "${F}"
|
||||||
|
;;
|
||||||
|
ovs_eth*)
|
||||||
|
ovs-vsctl del-br ${ETHX}
|
||||||
|
sed -i "/${ETHX##ovs_}/"d ${TMP_PATH}/mdX/usr/syno/etc/synoovs/ovs_interface.conf
|
||||||
|
rm -f "${F}"
|
||||||
|
;;
|
||||||
|
eth*)
|
||||||
echo -e "DEVICE=${ETHX}\nONBOOT=yes\nBOOTPROTO=dhcp\nIPV6INIT=auto_dhcp\nIPV6_ACCEPT_RA=1" >"${F}"
|
echo -e "DEVICE=${ETHX}\nONBOOT=yes\nBOOTPROTO=dhcp\nIPV6INIT=auto_dhcp\nIPV6_ACCEPT_RA=1" >"${F}"
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
@ -4208,6 +4219,7 @@ else
|
|||||||
echo "b \"$(TEXT "Boot the loader")\""
|
echo "b \"$(TEXT "Boot the loader")\""
|
||||||
fi
|
fi
|
||||||
echo "h \"$(TEXT "Settings menu")\""
|
echo "h \"$(TEXT "Settings menu")\""
|
||||||
|
echo "r \"$(TEXT "Online Assistance")\""
|
||||||
if [ "0$(du -sm "${PART3_PATH}/dl" 2>/dev/null | awk '{printf $1}')" -gt 1 ]; then
|
if [ "0$(du -sm "${PART3_PATH}/dl" 2>/dev/null | awk '{printf $1}')" -gt 1 ]; then
|
||||||
echo "c \"$(TEXT "Clean disk cache")\""
|
echo "c \"$(TEXT "Clean disk cache")\""
|
||||||
fi
|
fi
|
||||||
@ -4284,6 +4296,10 @@ else
|
|||||||
settingsMenu
|
settingsMenu
|
||||||
NEXT="m"
|
NEXT="m"
|
||||||
;;
|
;;
|
||||||
|
r)
|
||||||
|
cleanup_lock && exec "${WORK_PATH}/helper.sh"
|
||||||
|
NEXT="m"
|
||||||
|
;;
|
||||||
c)
|
c)
|
||||||
cleanCache
|
cleanCache
|
||||||
NEXT="d"
|
NEXT="d"
|
||||||
@ -4366,5 +4382,5 @@ else
|
|||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
echo -e "$(TEXT "Call \033[1;32mmenu.sh\033[0m to return to menu")"
|
echo -e "$(TEXT "Call \033[1;32mmenu.sh\033[0m to return to menu")"
|
||||||
${WORK_PATH}/init.sh
|
"${WORK_PATH}/init.sh"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -106,7 +106,7 @@ else
|
|||||||
if ! command -v unzip >/dev/null 2>&1; then
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
apt-get update >/dev/null 2>&1 && apt-get install -y unzip >/dev/null 2>&1
|
apt-get update >/dev/null 2>&1 && apt-get install -y unzip >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
IMG_FILE=$(unzip -l "/tmp/rr-${TAG}.img.zip" | awk '{print $4}' | grep '\.img$' | head -n 1)
|
IMG_FILE=$(unzip -l "/tmp/rr-${TAG}.img.zip" | awk '{print $4}' | grep '\.img$' | head -1)
|
||||||
if [ -z "${IMG_FILE}" ]; then
|
if [ -z "${IMG_FILE}" ]; then
|
||||||
echo "No img file found in rr-${TAG}.img.zip"
|
echo "No img file found in rr-${TAG}.img.zip"
|
||||||
exit 1
|
exit 1
|
||||||
@ -147,7 +147,7 @@ if [ "${EFI:-1}" -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 导入 RR 镜像
|
# 导入 RR 镜像
|
||||||
STORAGE=$(pvesm status -content images | awk 'NR>1 {print $1}')
|
STORAGE=$(pvesm status -content images | awk 'NR>1 {print $1}' | grep local | tail -1)
|
||||||
if [ -z "${STORAGE}" ]; then
|
if [ -z "${STORAGE}" ]; then
|
||||||
echo "No storage for images"
|
echo "No storage for images"
|
||||||
qm destroy ${VMID} --purge
|
qm destroy ${VMID} --purge
|
||||||
@ -205,7 +205,7 @@ fi
|
|||||||
# 添加 32G 数据盘
|
# 添加 32G 数据盘
|
||||||
qm set ${VMID} --sata1 local-lvm:32
|
qm set ${VMID} --sata1 local-lvm:32
|
||||||
|
|
||||||
BRIDGE=$(awk -F: '/^iface vmbr/ {print $1}' /etc/network/interfaces | awk '{print $2}' | head -n 1)
|
BRIDGE=$(awk -F: '/^iface vmbr/ {print $1}' /etc/network/interfaces | awk '{print $2}' | head -1)
|
||||||
if [ -z "${BRIDGE}" ]; then
|
if [ -z "${BRIDGE}" ]; then
|
||||||
echo "Get bridge failed"
|
echo "Get bridge failed"
|
||||||
qm destroy ${VMID} --purge
|
qm destroy ${VMID} --purge
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user