mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 21:49:52 +07:00
tree: full rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
3a28bf0ee9
commit
68ca715f7a
@ -831,6 +831,7 @@ function updateMenu() {
|
||||
6 "Update LKMs" \
|
||||
7 "Update Modules" \
|
||||
8 "Update Patches" \
|
||||
9 "Switch Buildroot" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
case "$(cat ${TMP_PATH}/resp)" in
|
||||
@ -1006,6 +1007,25 @@ function updateMenu() {
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
;;
|
||||
9)
|
||||
# Ask for Arc Branch
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Switch Buildroot" \
|
||||
--menu "Which Branch?" 0 0 0 \
|
||||
1 "x - latest" \
|
||||
2 "s - stable" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
[ -z "${opts}" ] && return 1
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
ARCBRANCH="x"
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
ARCBRANCH="s"
|
||||
fi
|
||||
writeConfigKey "arc.branch" "${ARCBRANCH}" "${USER_CONFIG_FILE}"
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
dialog --backtitle "$(backtitle)" --title "Switch Buildroot" --aspect 18 \
|
||||
--msgbox "Updates are using ${ARCBRANCH} Branch!" 0 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
return
|
||||
@ -1047,6 +1067,7 @@ function sysinfo() {
|
||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')
|
||||
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
if [ "${CONFDONE}" == "true" ]; then
|
||||
@ -1143,7 +1164,7 @@ function sysinfo() {
|
||||
TEXT+="\n\Zb$(lspci -s ${NETBUS} -nnk | awk '{$1=""}1' | awk '{$1=$1};1')\Zn\n"
|
||||
done
|
||||
# Print Config Informations
|
||||
TEXT+="\n\Z4> Arc: ${ARC_VERSION}\Zn"
|
||||
TEXT+="\n\Z4> Arc: ${ARC_VERSION} | Branch: ${ARCBRANCH}\Zn"
|
||||
TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn"
|
||||
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
|
||||
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
|
||||
|
@ -57,6 +57,7 @@ RAIDCONTROLLER="$(readConfigKey "device.raidcontroller" "${USER_CONFIG_FILE}")"
|
||||
SASCONTROLLER="$(readConfigKey "device.sascontroller" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Get Config/Build Status
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
|
@ -7,17 +7,6 @@ function bootDSM () {
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
|
||||
|
||||
# Proc open nvidia driver when booting
|
||||
NVPCI_ADDR=$(lspci -nd 10de: | grep -e 0300 -e 0302 | awk '{print $1}')
|
||||
if [ -n "${NVPCI_ADDR}" ]; then
|
||||
modprobe -r nouveau || true
|
||||
NVDEV_PATH=$(find /sys/devices -name *${NVPCI_ADDR} | grep -v supplier)
|
||||
for DEV_PATH in ${NVDEV_PATH}; do
|
||||
if [ -e ${DEV_PATH}/reset ]; then
|
||||
echo 1 > ${DEV_PATH}/reset || true
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Print Title centralized
|
||||
clear
|
||||
COLUMNS=${COLUMNS:-50}
|
||||
@ -127,7 +116,7 @@ function bootDSM () {
|
||||
CMDLINE["syno_ttyS0"]="serial,0x3f8"
|
||||
CMDLINE["syno_ttyS1"]="serial,0x2f8"
|
||||
else
|
||||
# CMDLINE["SMBusHddDynamicPower"]="1"
|
||||
CMDLINE["SMBusHddDynamicPower"]="1"
|
||||
CMDLINE["syno_hdd_detect"]="0"
|
||||
CMDLINE["syno_hdd_powerup_seq"]="0"
|
||||
fi
|
||||
@ -139,7 +128,7 @@ function bootDSM () {
|
||||
CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8"
|
||||
CMDLINE['console']="ttyS0,115200n8"
|
||||
CMDLINE['consoleblank']="600"
|
||||
CMDLINE['no_console_suspend']="1"
|
||||
# CMDLINE['no_console_suspend']="1"
|
||||
CMDLINE['root']="/dev/md0"
|
||||
CMDLINE['rootwait']=""
|
||||
CMDLINE['loglevel']="15"
|
||||
@ -160,8 +149,8 @@ function bootDSM () {
|
||||
CMDLINE['modprobe.blacklist']+="mpt3sas"
|
||||
fi
|
||||
fi
|
||||
CMDLINE['kvm.ignore_msrs']="1"
|
||||
CMDLINE['kvm.report_ignored_msrs']="0"
|
||||
# CMDLINE['kvm.ignore_msrs']="1"
|
||||
# CMDLINE['kvm.report_ignored_msrs']="0"
|
||||
if echo "apollolake geminilake" | grep -wq "${PLATFORM}"; then
|
||||
CMDLINE["intel_iommu"]="igfx_off"
|
||||
fi
|
||||
@ -307,6 +296,16 @@ function bootDSM () {
|
||||
# Clear logs for dbgutils addons
|
||||
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
|
||||
|
||||
# Unload all network interfaces
|
||||
for D in $(readlink /sys/class/net/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
|
||||
|
||||
# Unload all graphics drivers
|
||||
# for D in $(readlink /sys/class/drm/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
|
||||
for D in $(lsmod | grep -E '^(nouveau|amdgpu|radeon|i915)' | awk '{print $1}'); do rmmod -f "${D}" 2>/dev/null || true; done
|
||||
for I in $(find /sys/devices -name uevent -exec bash -c 'cat {} 2>/dev/null | grep -Eq "PCI_CLASS=0?30[0|1|2]00" && dirname {}' \;); do
|
||||
[ -e ${I}/reset ] && cat ${I}/vendor >/dev/null | grep -iq 0x10de && echo 1 >${I}/reset || true # Proc open nvidia driver when booting
|
||||
done
|
||||
|
||||
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
|
||||
[ "${KERNELLOAD}" == "kexec" ] && kexec -a -e || poweroff
|
||||
exit 0
|
||||
|
@ -7,6 +7,7 @@
|
||||
function upgradeLoader () {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
|
||||
local ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
@ -43,35 +44,35 @@ function upgradeLoader () {
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}.img.zip"
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${ARCBRANCH}-${TAG}.img.zip"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/arc-${TAG}.img.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/arc-${ARCBRANCH}-${TAG}.img.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
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/arc-${TAG}.img.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/arc-${ARCBRANCH}-${TAG}.img.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
|
||||
fi
|
||||
if [ -f "${TMP_PATH}/arc-${TAG}.img.zip" ]; then
|
||||
if [ -f "${TMP_PATH}/arc-${ARCBRANCH}-${TAG}.img.zip" ]; then
|
||||
echo "Downloading Upgradefile successful!"
|
||||
else
|
||||
echo "Error downloading Upgradefile!"
|
||||
sleep 5
|
||||
return 1
|
||||
fi
|
||||
unzip -oq "${TMP_PATH}/arc-${TAG}.img.zip" -d "${TMP_PATH}"
|
||||
rm -f "${TMP_PATH}/arc-${TAG}.img.zip" >/dev/null
|
||||
unzip -oq "${TMP_PATH}/arc-${ARCBRANCH}-${TAG}.img.zip" -d "${TMP_PATH}"
|
||||
rm -f "${TMP_PATH}/arc-${ARCBRANCH}-${TAG}.img.zip" >/dev/null
|
||||
echo "Installing new Loader Image..."
|
||||
# Process complete update
|
||||
umount "${PART1_PATH}" "${PART2_PATH}" "${PART3_PATH}"
|
||||
dd if="${TMP_PATH}/arc.img" of=$(blkid | grep 'LABEL="ARC3"' | cut -d3 -f1) bs=1M conv=fsync
|
||||
dd if="${TMP_PATH}/arc-${ARCBRANCH}.img" of=$(blkid | grep 'LABEL="ARC3"' | cut -d3 -f1) bs=1M conv=fsync
|
||||
# Ask for Boot
|
||||
rm -f "${TMP_PATH}/arc.img" >/dev/null
|
||||
rm -f "${TMP_PATH}/arc-${ARCBRANCH}.img" >/dev/null
|
||||
echo "Upgrade done! -> Rebooting..."
|
||||
sleep 2
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
@ -85,6 +86,7 @@ function upgradeLoader () {
|
||||
function updateLoader() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
|
||||
local ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
@ -126,38 +128,37 @@ function updateLoader() {
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc/releases/download/${TAG}/checksum.sha256"
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${ARCBRANCH}.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc/releases/download/${TAG}/checksum-${ARCBRANCH}.sha256"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/update-${ARCBRANCH}.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"
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum-${ARCBRANCH}.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/update-${ARCBRANCH}.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"
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum-${ARCBRANCH}.sha256"
|
||||
fi
|
||||
if [ "$(sha256sum "${TMP_PATH}/update.zip" | awk '{print $1}')" = "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
if [ "$(sha256sum "${TMP_PATH}/update-${ARCBRANCH}.zip" | awk '{print $1}')" = "$(cat ${TMP_PATH}/checksum-${ARCBRANCH}.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}"
|
||||
unzip -oq "${TMP_PATH}/update-${ARCBRANCH}.zip" -d "${TMP_PATH}"
|
||||
echo "Installing new Loader Image..."
|
||||
mv -f "${TMP_PATH}/grub.cfg" "${USER_GRUB_CONFIG}"
|
||||
mv -f "${TMP_PATH}/ARC-VERSION" "${PART1_PATH}/ARC-VERSION"
|
||||
mv -f "${TMP_PATH}/bzImage-arc" "${ARC_BZIMAGE_FILE}"
|
||||
mv -f "${TMP_PATH}/initrd-arc" "${ARC_RAMDISK_FILE}"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
rm -f "${TMP_PATH}/update-${ARCBRANCH}.zip"
|
||||
else
|
||||
echo "Error getting new Version!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
[ -f "${TMP_PATH}/update.zip" ] && rm -f "${TMP_PATH}/update.zip"
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
|
@ -82,6 +82,7 @@ if grep -q "automated_arc" /proc/cmdline; then
|
||||
else
|
||||
writeConfigKey "automated" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
[ echo "${ARC_VERSION}" | grep -q "s" ] && writeConfigKey "arc.branch" "s" "${USER_CONFIG_FILE}" || writeConfigKey "arc.branch" "x" "${USER_CONFIG_FILE}"
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null
|
||||
# Check for compatibility
|
||||
compatboot
|
||||
@ -110,6 +111,7 @@ for ETH in ${ETHX}; do
|
||||
sleep 1
|
||||
fi
|
||||
[ "${ETH::3}" = "eth" ] && ethtool -s ${ETH} wol g 2>/dev/null || true
|
||||
[ "${ETH::3}" = "eth" ] && ethtool -K ${ETH} rxhash off 2>/dev/null || true
|
||||
initConfigKey "${ETH}" "${MACR}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
|
@ -78,7 +78,7 @@ set menu_color_normal=white/black
|
||||
set menu_color_highlight=white/red
|
||||
set color_normal=white/black
|
||||
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait pcie_aspm=off net.ifnames=0 nox2apic nomodeset iommu=off"
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait pcie_aspm=off net.ifnames=0 nox2apic nomodeset intremap=off"
|
||||
|
||||
search --set=root --label "ARC3"
|
||||
if [ -e /automated ]; then
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -204,7 +204,7 @@ function getTheme() {
|
||||
function getBuildroot() {
|
||||
echo "Getting Buildroot begin"
|
||||
TAG="${1:-latest}"
|
||||
local DEST_PATH="${2:-br}"
|
||||
local DEST_PATH="${2:-brx}"
|
||||
|
||||
if [ "${TAG}" = "latest" ]; then
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
|
@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
GRUB=${1:-"grub-2.12"}
|
||||
BIOS=${2:-"i386-pc i386-efi x86_64-efi"}
|
||||
NAME=${3:-"ARC"}
|
||||
|
||||
curl -#kLO https://ftp.gnu.org/gnu/grub/${GRUB}.tar.gz
|
||||
tar -zxvf ${GRUB}.tar.gz
|
||||
|
||||
pushd ${GRUB}
|
||||
echo depends bli part_gpt > grub-core/extra_deps.lst
|
||||
for B in ${BIOS}; do
|
||||
b=${B}
|
||||
b=(${b//-/ })
|
||||
echo "Make ${b[@]} ..."
|
||||
mkdir -p ${B}
|
||||
pushd ${B}
|
||||
../configure --prefix=$PWD/usr -sbindir=$PWD/sbin --sysconfdir=$PWD/etc --disable-werror --target=${b[0]} --with-platform=${b[1]}
|
||||
make
|
||||
make install
|
||||
popd
|
||||
done
|
||||
popd
|
||||
|
||||
rm -f grub.img
|
||||
dd if=/dev/zero of=grub.img bs=1M seek=1024 count=0
|
||||
echo -e "n\np\n1\n\n+50M\nn\np\n2\n\n+50M\nn\np\n3\n\n\na\n1\nw\nq\n" | fdisk grub.img
|
||||
fdisk -l grub.img
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P ${LOOPX} grub.img
|
||||
sudo mkdosfs -F32 -n ${NAME}1 ${LOOPX}p1
|
||||
sudo mkfs.ext2 -F -L ${NAME}2 ${LOOPX}p2
|
||||
sudo mkfs.ext4 -F -L ${NAME}3 ${LOOPX}p3
|
||||
|
||||
rm -rf ${NAME}1
|
||||
mkdir -p ${NAME}1
|
||||
sudo mount ${LOOPX}p1 ${NAME}1
|
||||
|
||||
sudo mkdir -p ${NAME}1/EFI
|
||||
sudo mkdir -p ${NAME}1/boot/grub
|
||||
cat >device.map <<EOF
|
||||
(hd0) ${LOOPX}
|
||||
EOF
|
||||
sudo mv device.map ${NAME}1/boot/grub/device.map
|
||||
|
||||
for B in ${BIOS}; do
|
||||
args=""
|
||||
args+=" ${LOOPX} --target=${B} --no-floppy --recheck --grub-mkdevicemap=${NAME}1/boot/grub/device.map --boot-directory=${NAME}1/boot"
|
||||
if [[ "${B}" == *"efi" ]]; then
|
||||
args+=" --efi-directory=${NAME}1 --removable --no-nvram"
|
||||
else
|
||||
args+=" --root-directory=${NAME}1"
|
||||
fi
|
||||
sudo ${GRUB}/${B}/grub-install ${args}
|
||||
done
|
||||
|
||||
if [ -d ${NAME}1/boot/grub/fonts ] && [ -f /usr/share/grub/unicode.pf2 ]; then
|
||||
sudo cp /usr/share/grub/unicode.pf2 ${NAME}1/boot/grub/fonts
|
||||
fi
|
||||
|
||||
sudo sync
|
||||
|
||||
sudo umount ${LOOPX}p1
|
||||
sudo losetup -d ${LOOPX}
|
||||
sudo rm -rf ${NAME}1
|
||||
|
||||
gzip grub.img
|
Loading…
Reference in New Issue
Block a user