Skip to content

Commit

Permalink
fix RecoveryDSM
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Oct 30, 2023
1 parent 6dda1bb commit a6cb819
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions files/initrd/opt/rr/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ function getLogo() {
# (based on pocopico's TCRP code)
function findAndMountDSMRoot() {
[ $(mount | grep -i "${DSMROOT_PATH}" | wc -l) -gt 0 ] && return 0
dsmrootdisk="$(blkid | grep -i linux_raid_member | grep /dev/.*1: | head -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 All @@ -336,7 +337,6 @@ function findAndMountDSMRoot() {

###############################################################################
# Rebooting
# (based on pocopico's TCRP code)
function rebootTo() {
[ "${1}" != "junior" -a "${1}" != "config" ] && exit 1
# echo "Rebooting to ${1} mode"
Expand Down
12 changes: 5 additions & 7 deletions files/initrd/opt/rr/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1501,8 +1501,6 @@ function tryRecoveryDSM() {
if findAndMountDSMRoot; then
MODEL=""
PRODUCTVER=""
BUILDNUM=""
SMALLNUM=""
if [ -f "${DSMROOT_PATH}/.syno/patch/VERSION" ]; then
eval $(cat ${DSMROOT_PATH}/.syno/patch/VERSION | grep unique)
eval $(cat ${DSMROOT_PATH}/.syno/patch/VERSION | grep majorversion)
Expand All @@ -1523,16 +1521,16 @@ function tryRecoveryDSM() {
if [ -n "${PRODUCTVER}" ]; then
cp -f "${DSMROOT_PATH}/.syno/patch/zImage" "${PART2_PATH}"
cp -f "${DSMROOT_PATH}/.syno/patch/rd.gz" "${PART2_PATH}"
MSG="$(printf "$(TEXT "Found a installation:\nModel: %s\nProductversion: %s")" "${MODEL}" "${PRODUCTVER}")"
BUILDNUM=${buildnumber}
SMALLNUM=${smallfixnumber}
writeConfigKey "buildnum" "${BUILDNUM}" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
MSG="$(printf "$(TEXT "Found a installation:\nModel: %s\nProductversion: %s")" "${MODEL}" "${PRODUCTVER}(${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))")"
SN=$(_get_conf_kv SN "${DSMROOT_PATH}/etc/synoinfo.conf")
if [ -n "${SN}" ]; then
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
MSG+="$(printf "$(TEXT "\nSerial: %s")" "${SN}")"
fi
BUILDNUM=${buildnumber}
SMALLNUM=${smallfixnumber}
writeConfigKey "buildnum" "${BUILDNUM}" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --colors --title "$(TEXT "Try recovery DSM")" \
--msgbox "${MSG}" 0 0
fi
Expand Down

0 comments on commit a6cb819

Please sign in to comment.