Skip to content

Commit

Permalink
Merge pull request #637 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AuxXxilium authored Oct 30, 2023
2 parents d6fa841 + 8018e4f commit 2cde81c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
5 changes: 3 additions & 2 deletions files/board/arc/overlayfs/opt/arc/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ function getIP() {
# (based on pocopico's TCRP code)
function findAndMountDSMRoot() {
[ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -gt 0 ] && return 0
dsmrootdisk="$(blkid /dev/sd* | grep -i raid | awk '{print $1 " " $4}' | grep UUID | grep sd[a-z]1 | head -1 | awk -F ":" '{print $1}')"
[ -z "${dsmrootdisk}" ] && return 1
dsmrootdisk="$(blkid | grep -i linux_raid_member | grep -E "/dev/.*1:" | head -1 | awk -F ":" '{print $1}')"
[ -z "${dsmrootdisk}" ] && return -1
[ ! -d "${DSMROOT_PATH}" ] && mkdir -p "${DSMROOT_PATH}"
[ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -eq 0 ] && mount -t ext4 "${dsmrootdisk}" "${DSMROOT_PATH}"
if [ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -eq 0 ]; then
echo "Failed to mount"
Expand Down
2 changes: 1 addition & 1 deletion files/board/arc/overlayfs/opt/arc/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ BUS=$(getBus "${LOADER_DISK}")
if [ "${BUS}" = "usb" ]; then
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)"
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)"
elif [ "${BUS}" != "sata" -a "${BUS}" != "scsi" -a "${BUS}" != "nvme" ]; then
elif [ "${BUS}" != "sata" ] && [ "${BUS}" != "scsi" ] && [ "${BUS}" != "nvme" ]; then
die "Loader disk is not USB or SATA/SCSI/NVME DoM"
fi

Expand Down
22 changes: 16 additions & 6 deletions files/board/arc/overlayfs/usr/sbin/loader-reboot.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
#!/usr/bin/env ash
#!/usr/bin/env bash

function use() {
echo "Use: ${0} junior|config"
exit 1
}

# Sanity checks
if [ ! ${USER} = "root" ]; then
exec sudo $0 $@
fi
[ -z "${1}" ] && use
[ "${1}" != "junior" ] && [ "${1}" != "config" ] && use
[ ! "${1}" = "junior" -a ! "${1}" = "config" ] && use
echo "Rebooting to ${1} mode"
GRUBPATH="$(dirname $(find ${BOOTLOADER_PATH}/ -name grub.cfg | head -1))"
echo 1 > /proc/sys/kernel/syno_install_flag
mount /dev/synoboot1 /mnt
GRUBPATH="$(dirname $(find /mnt/ -name grub.cfg | head -1))"
ENVFILE="${GRUBPATH}/grubenv"
[ ! -f "${ENVFILE}" ] && grub-editenv "${ENVFILE}" create
grub-editenv "${ENVFILE}" set next_entry="${1}"
reboot
[ ! -f "${ENVFILE}" ] && grub-editenv ${ENVFILE} create

grub-editenv ${ENVFILE} set next_entry="${1}"
umount /mnt
[ -x /usr/syno/sbin/synopoweroff ] && \
/usr/syno/sbin/synopoweroff -r ||
reboot

0 comments on commit 2cde81c

Please sign in to comment.