Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
012e825d96 | ||
|
|
f571cae9ba | ||
|
|
bab144cfe0 | ||
|
|
d8db7bbbab | ||
|
|
e084f9c225 | ||
|
|
eec2393740 |
77
.github/workflows/build.yml
vendored
77
.github/workflows/build.yml
vendored
@@ -38,7 +38,7 @@ on:
|
||||
type: boolean
|
||||
microcode:
|
||||
description: "microcode"
|
||||
default: true
|
||||
default: false
|
||||
type: boolean
|
||||
extended:
|
||||
description: "extended"
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
releases_keep_latest: 1
|
||||
delete_workflows: false
|
||||
delete_tags: true
|
||||
gh_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
gh_token: ${{ secrets.BUILD_TOKEN }}
|
||||
|
||||
# Install Dependencies
|
||||
- name: Install Dependencies
|
||||
@@ -98,9 +98,15 @@ jobs:
|
||||
getOffline "files/p3/configs"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
getBuildrootx "brx"
|
||||
getBuildroots "brs"
|
||||
getBuildrootm "brm"
|
||||
if [ "${{ inputs.extended }}" = "true" ]; then
|
||||
getBuildroot "ext" "brx"
|
||||
fi
|
||||
if [ "${{ inputs.minimal }}" = "true" ]; then
|
||||
getBuildroot "min" "brs"
|
||||
fi
|
||||
if [ "${{ inputs.microcode }}" = "true" ]; then
|
||||
getBuildroot "micro" "brm"
|
||||
fi
|
||||
|
||||
# Export Dependencies Version to env
|
||||
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
||||
@@ -112,6 +118,7 @@ jobs:
|
||||
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
|
||||
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
|
||||
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
|
||||
echo "BRMTAG=${BRMTAG}" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
|
||||
|
||||
echo "OK"
|
||||
@@ -123,19 +130,19 @@ jobs:
|
||||
. scripts/func.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
ARC_VERSION="${{ inputs.version }}"
|
||||
ARC_BRANCH="extended"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "${ARC_BUILD}" > "files/p1/ARC-BUILD"
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "${ARC_VERSION}" > "files/p1/ARC-VERSION"
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "${ARC_BRANCH}" > "files/p1/ARC-BRANCH"
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc_create.img"
|
||||
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
@@ -166,12 +173,7 @@ jobs:
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
# Resize Image
|
||||
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
|
||||
rm -f "${IMAGE_FILE}"
|
||||
|
||||
echo "Image Converter"
|
||||
IMAGE_FILE="arc.img"
|
||||
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
|
||||
@@ -198,6 +200,7 @@ jobs:
|
||||
|
||||
# Cleanup
|
||||
- name: Cleanup
|
||||
if: ${{ inputs.extended }}
|
||||
run: |
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
|
||||
|
||||
@@ -208,19 +211,19 @@ jobs:
|
||||
. scripts/func.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
ARC_VERSION="${{ inputs.version }}"
|
||||
ARC_BRANCH="minimal"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "${ARC_BUILD}" > "files/p1/ARC-BUILD"
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "${ARC_VERSION}" > "files/p1/ARC-VERSION"
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "${ARC_BRANCH}" > "files/p1/ARC-BRANCH"
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc_create.img"
|
||||
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
@@ -251,12 +254,7 @@ jobs:
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
# Resize Image
|
||||
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
|
||||
rm -f "${IMAGE_FILE}"
|
||||
|
||||
echo "Image Converter"
|
||||
IMAGE_FILE="arc.img"
|
||||
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
|
||||
@@ -283,6 +281,7 @@ jobs:
|
||||
|
||||
# Cleanup
|
||||
- name: Cleanup
|
||||
if: ${{ inputs.minimal }}
|
||||
run: |
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
|
||||
|
||||
@@ -293,19 +292,19 @@ jobs:
|
||||
. scripts/func.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
ARC_VERSION="${{ inputs.version }}"
|
||||
ARC_BRANCH="microcode"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "${ARC_BUILD}" > "files/p1/ARC-BUILD"
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "${ARC_VERSION}" > "files/p1/ARC-VERSION"
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "${ARC_BRANCH}" > "files/p1/ARC-BRANCH"
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc_create.img"
|
||||
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
@@ -336,12 +335,7 @@ jobs:
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
# Resize Image
|
||||
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
|
||||
rm -f "${IMAGE_FILE}"
|
||||
|
||||
echo "Image Converter"
|
||||
IMAGE_FILE="arc.img"
|
||||
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
|
||||
@@ -384,9 +378,9 @@ jobs:
|
||||
- Discord Account for Arc Patch needed
|
||||
|
||||
### Versions:
|
||||
${{ inputs.minimal && '- minimal: Full Image, all dependencies are included (reduced size, faster boot)' || '' }}
|
||||
${{ inputs.microcode && '- microcode: Minimal + additional Microcode Updates' || '' }}
|
||||
${{ inputs.extended && '- extended: Full Image, all dependencies are included (new features to test)' || '' }}
|
||||
${{ inputs.minimal && '- minimal: full image, all dependencies included (reduced size, faster boot)' || '' }}
|
||||
${{ inputs.microcode && '- microcode: minimal + additional microcode updates' || '' }}
|
||||
${{ inputs.extended && '- extended: full image, all dependencies included (new features to test)' || '' }}
|
||||
|
||||
### Dependencies:
|
||||
- Addons: ${{ env.ADDONTAG }}
|
||||
@@ -396,6 +390,7 @@ jobs:
|
||||
- Custom: ${{ env.CUSTOMTAG }}
|
||||
- LKMs: ${{ env.LKMTAG }}
|
||||
${{ inputs.minimal && format('- Buildroot minimal: {0}', env.BRSTAG) || '' }}
|
||||
${{ inputs.microcode && format('- Buildroot microcode: {0}', env.BRMTAG) || '' }}
|
||||
${{ inputs.extended && format('- Buildroot extended: {0}', env.BRXTAG) || '' }}
|
||||
|
||||
### Release
|
||||
|
||||
1
.github/workflows/grub.yml
vendored
1
.github/workflows/grub.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
||||
if: success() && inputs.push == true
|
||||
run: |
|
||||
if [ -f "grub.img.gz" ]; then
|
||||
mv -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
|
||||
echo "Git push ..."
|
||||
git pull
|
||||
status=$(git status -s | grep -E 'grub.img.gz' | awk '{printf " %s", $2}')
|
||||
|
||||
@@ -7,13 +7,19 @@ tasks:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-ext.sh
|
||||
- ./img-gen.sh ext
|
||||
|
||||
build-min:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-min.sh
|
||||
- ./img-gen.sh min
|
||||
|
||||
build-micro:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-gen.sh micro
|
||||
|
||||
compile-kpatch:
|
||||
dir: kpatch
|
||||
|
||||
@@ -39,53 +39,41 @@ function addonSelection() {
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
|
||||
# read addons from user config
|
||||
unset ADDONS
|
||||
declare -A ADDONS
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
rm -f "${TMP_PATH}/opts" >/dev/null
|
||||
|
||||
rm -f "${TMP_PATH}/opts"
|
||||
touch "${TMP_PATH}/opts"
|
||||
|
||||
while read -r ADDON DESC; do
|
||||
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off"
|
||||
if [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARCCONF}" ]; then
|
||||
continue
|
||||
elif [ "${ADDON}" = "codecpatch" ] && [ -n "${ARCCONF}" ]; then
|
||||
if { [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARCCONF}" ]; } || { [ "${ADDON}" = "codecpatch" ] && [ -n "${ARCCONF}" ]; }; then
|
||||
continue
|
||||
else
|
||||
echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts"
|
||||
fi
|
||||
done < <(availableAddons "${PLATFORM}")
|
||||
if [ "${STEP}" = "addons" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Addons" --colors --aspect 18 \
|
||||
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
|
||||
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Addons" --colors --aspect 18 \
|
||||
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
|
||||
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
fi
|
||||
unset ADDONS
|
||||
|
||||
dialog --backtitle "$(backtitle)" --title "Addons" --colors --aspect 18 \
|
||||
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
|
||||
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
|
||||
declare -A ADDONS
|
||||
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
|
||||
for ADDON in ${resp}; do
|
||||
ADDONS["${ADDON}"]=""
|
||||
writeConfigKey "addons.\"${ADDON}\"" "" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
|
||||
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
|
||||
if [ "${STEP}" = "addons" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Addons" \
|
||||
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Addons" \
|
||||
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
|
||||
fi
|
||||
return
|
||||
dialog --backtitle "$(backtitle)" --title "Addons" \
|
||||
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -2371,7 +2359,7 @@ function getpatfiles() {
|
||||
VALID="false"
|
||||
if [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "false" ]; then
|
||||
rm -f ${USER_UP_PATH}/*.tar
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Boot Files" \
|
||||
--infobox "Downloading DSM Boot Files..." 3 40
|
||||
# Get new Files
|
||||
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
|
||||
@@ -2380,7 +2368,7 @@ function getpatfiles() {
|
||||
fi
|
||||
elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "true" ]; then
|
||||
rm -f ${USER_UP_PATH}/*.tar
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Boot Files" \
|
||||
--msgbox "Please upload the DSM Boot File to ${USER_UP_PATH}.\nUse ${IPCON}:7304 to upload and press OK after it's finished.\nLink: https://github.com/AuxXxilium/arc-dsm/blob/main/files/${MODEL}/${PRODUCTVER}/${PAT_HASH}.tar" 8 120
|
||||
[ $? -ne 0 ] && VALID="false"
|
||||
if [ -f "${DSM_FILE}" ]; then
|
||||
@@ -2391,7 +2379,7 @@ function getpatfiles() {
|
||||
fi
|
||||
mkdir -p "${UNTAR_PAT_PATH}"
|
||||
if [ "${VALID}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "DSM Boot Files" --aspect 18 \
|
||||
dialog --backtitle "$(backtitle)" --title "DSM Boot Files" --aspect 18 \
|
||||
--infobox "Copying DSM Boot Files..." 3 40
|
||||
tar -xf "${DSM_FILE}" -C "${UNTAR_PAT_PATH}" 2>/dev/null
|
||||
copyDSMFiles "${UNTAR_PAT_PATH}" 2>/dev/null
|
||||
|
||||
@@ -71,24 +71,11 @@ function backtitle() {
|
||||
echo "${BACKTITLE}"
|
||||
}
|
||||
|
||||
function backtitlep() {
|
||||
[ "${STEP}" = "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
|
||||
[ "${STEP}" = "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
|
||||
[ "${STEP}" = "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
|
||||
[ "${STEP}" = "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
|
||||
[ "${STEP}" = "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
|
||||
[ "${STEP}" = "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
|
||||
[ "${STEP}" = "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
|
||||
[ "${STEP}" = "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
|
||||
echo "${BACKTITLEP}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Model Selection
|
||||
function arcModel() {
|
||||
STEP="model"
|
||||
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
|
||||
dialog --backtitle "$(backtitlep)" --title "Model" \
|
||||
dialog --backtitle "$(backtitle)" --title "Model" \
|
||||
--infobox "Reading Models..." 3 25
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
# Loop menu
|
||||
@@ -132,10 +119,9 @@ function arcModel() {
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${M}" = "DS718+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
|
||||
# Check id model is compatible with CPU
|
||||
if [ ${RESTRICT} -eq 1 ]; then
|
||||
for F in "${FLAGS}"; do
|
||||
for F in ${FLAGS}; do
|
||||
if ! grep -q "^flags.*${F}.*" /proc/cpuinfo; then
|
||||
COMPATIBLE=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "${A}" != "epyc7002" ] && [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
|
||||
@@ -165,7 +151,7 @@ function arcModel() {
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
[ -n "${ARCCONF}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
|
||||
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
|
||||
dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \
|
||||
dialog --backtitle "$(backtitle)" --title "${TITLEMSG}" --colors \
|
||||
--cancel-label "Show all" --help-button --help-label "Exit" \
|
||||
--extra-button --extra-label "Info" \
|
||||
--menu "${MSG}" 0 115 0 \
|
||||
@@ -183,7 +169,7 @@ function arcModel() {
|
||||
3)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
|
||||
dialog --backtitle "$(backtitlep)" --colors \
|
||||
dialog --backtitle "$(backtitle)" --colors \
|
||||
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
|
||||
;;
|
||||
*)
|
||||
@@ -233,7 +219,6 @@ function arcModel() {
|
||||
###############################################################################
|
||||
# Arc Version Section
|
||||
function arcVersion() {
|
||||
STEP="version"
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
@@ -246,7 +231,7 @@ function arcVersion() {
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
|
||||
# Select Build for DSM
|
||||
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
|
||||
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitlep)" \
|
||||
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
|
||||
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return
|
||||
@@ -263,7 +248,7 @@ function arcVersion() {
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
dialog --backtitle "$(backtitlep)" --title "Version" \
|
||||
dialog --backtitle "$(backtitle)" --title "Version" \
|
||||
--infobox "Reading DSM Build..." 3 25
|
||||
PAT_URL=""
|
||||
PAT_HASH=""
|
||||
@@ -280,7 +265,7 @@ function arcVersion() {
|
||||
PREV="${V}"
|
||||
done < <(echo "${PVS}")
|
||||
DSMPVS="$(cat ${TMP_PATH}/versions)"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "DSM Build" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Build" \
|
||||
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
|
||||
2>${TMP_PATH}/resp
|
||||
RET=$?
|
||||
@@ -299,7 +284,7 @@ function arcVersion() {
|
||||
MSG="Failed to get PAT Data.\n"
|
||||
MSG+="Please manually fill in the URL and Hash of PAT.\n"
|
||||
MSG+="You will find these Data at: https://github.com/AuxXxilium/arc-dsm/blob/main/webdata.txt"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Arc Build" --default-button "OK" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" --default-button "OK" \
|
||||
--form "${MSG}" 11 120 2 "Url" 1 1 "${PAT_URL}" 1 8 110 0 "Hash" 2 1 "${PAT_HASH}" 2 8 110 0 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
@@ -318,7 +303,7 @@ function arcVersion() {
|
||||
fi
|
||||
if [ "${ONLYVERSION}" != "true" ]; then
|
||||
MSG="Do you want to try Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Automated Mode" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
|
||||
--yesno "${MSG}" 6 55
|
||||
if [ $? -eq 0 ]; then
|
||||
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
|
||||
@@ -332,8 +317,8 @@ function arcVersion() {
|
||||
fi
|
||||
# Change Config if Files are valid
|
||||
if [ "${VALID}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Arc Config" \
|
||||
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" \
|
||||
--infobox "Reconfiguring Cmdline, Modules and Synoinfo" 3 60
|
||||
# Reset Synoinfo
|
||||
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
@@ -400,7 +385,7 @@ function arcVersion() {
|
||||
arcPatch
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitlep)" --title "Arc Config" --aspect 18 \
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Config" --aspect 18 \
|
||||
--infobox "Arc Config failed!\nExit." 4 40
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
@@ -412,7 +397,6 @@ function arcVersion() {
|
||||
###############################################################################
|
||||
# Arc Patch Section
|
||||
function arcPatch() {
|
||||
STEP="snmac"
|
||||
# Read Model Values
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
@@ -426,7 +410,7 @@ function arcPatch() {
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
|
||||
@@ -434,7 +418,7 @@ function arcPatch() {
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
else
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
@@ -454,7 +438,7 @@ function arcPatch() {
|
||||
;;
|
||||
3)
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Serial" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Serial" \
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
@@ -475,7 +459,6 @@ function arcPatch() {
|
||||
###############################################################################
|
||||
# Arc Settings Section
|
||||
function arcSettings() {
|
||||
STEP="build"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
@@ -483,12 +466,10 @@ function arcSettings() {
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Network Config for Loader
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
STEP="network"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet || return
|
||||
@@ -502,8 +483,7 @@ function arcSettings() {
|
||||
|
||||
# Select Portmap for Loader
|
||||
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
|
||||
STEP="storagemap"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
|
||||
--infobox "Generating Storage Map..." 3 40
|
||||
sleep 2
|
||||
getmapSelection || return
|
||||
@@ -511,8 +491,7 @@ function arcSettings() {
|
||||
|
||||
# Select Addons
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
STEP="addons"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Addons" \
|
||||
--infobox "Loading Addons Table..." 3 40
|
||||
addonSelection || return
|
||||
fi
|
||||
@@ -520,7 +499,7 @@ function arcSettings() {
|
||||
# CPU Frequency Scaling & Governor
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
|
||||
--infobox "Generating Governor Table..." 3 40
|
||||
governorSelection || return
|
||||
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
@@ -534,13 +513,13 @@ function arcSettings() {
|
||||
|
||||
# Warnings and Checks
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
|
||||
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
MODELNIC="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
|
||||
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
|
||||
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
|
||||
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
|
||||
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
|
||||
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
|
||||
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
|
||||
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
|
||||
fi
|
||||
|
||||
# eMMC Boot Support
|
||||
@@ -556,8 +535,9 @@ function arcSettings() {
|
||||
# Final Config Check
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
dialog --clear --backtitle "$(backtitlep)" --title "Config done" \
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Config done" \
|
||||
--no-cancel --menu "Build now?" 7 40 0 \
|
||||
1 "Yes - Build Arc Loader now" \
|
||||
2 "No - I want to make changes" \
|
||||
@@ -577,7 +557,6 @@ function arcSettings() {
|
||||
###############################################################################
|
||||
# Show Summary of Config
|
||||
function arcSummary() {
|
||||
STEP="build"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
@@ -642,7 +621,7 @@ function arcSummary() {
|
||||
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
|
||||
SUMMARY+="\n"
|
||||
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Config Summary" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Config Summary" \
|
||||
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
|
||||
|
||||
RET=$?
|
||||
@@ -659,7 +638,6 @@ function arcSummary() {
|
||||
###############################################################################
|
||||
# Building Loader
|
||||
function make() {
|
||||
STEP="build"
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
@@ -693,7 +671,7 @@ function make() {
|
||||
(
|
||||
livepatch
|
||||
sleep 3
|
||||
) 2>&1 | dialog --backtitle "$(backtitlep)" --colors --title "Build Loader" \
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Build Loader" \
|
||||
--progressbox "Patching DSM Files..." 20 70
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
@@ -723,7 +701,6 @@ function make() {
|
||||
###############################################################################
|
||||
# Finish Building Loader
|
||||
function arcFinish() {
|
||||
STEP="boot"
|
||||
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,46 +1,29 @@
|
||||
# Get PortMap for Loader
|
||||
function detect_drives() {
|
||||
local pci_id=$1
|
||||
local drive_var=$2
|
||||
local class_path=$3
|
||||
local grep_pattern=$4
|
||||
local sed_pattern=$5
|
||||
|
||||
eval "${drive_var}=0"
|
||||
if [ $(lspci -d ::${pci_id} 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::${pci_id} 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l ${class_path} | grep "${PCI}" | awk -F'/' '{print $NF}' | sed "${sed_pattern}" | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "${grep_pattern}${PORT}:" | wc -l)
|
||||
eval "${drive_var}=\$((\${${drive_var}} + \${PORTNUM}))"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function show_dialog() {
|
||||
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
|
||||
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
|
||||
1 "DiskIdxMap: Active Ports ${REMAP1}" \
|
||||
2 "DiskIdxMap: Max Ports ${REMAP2}" \
|
||||
3 "SataRemap: Remove empty Ports ${REMAP3}" \
|
||||
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
|
||||
5 "Set my own Portmap in Config" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
}
|
||||
|
||||
function set_remap() {
|
||||
case ${resp} in
|
||||
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
|
||||
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
|
||||
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
|
||||
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
|
||||
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function getmap() {
|
||||
function show_dialog() {
|
||||
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
|
||||
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
|
||||
1 "DiskIdxMap: Active Ports ${REMAP1}" \
|
||||
2 "DiskIdxMap: Max Ports ${REMAP2}" \
|
||||
3 "SataRemap: Remove empty Ports ${REMAP3}" \
|
||||
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
|
||||
5 "Set my own Portmap in Config" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 1
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
}
|
||||
|
||||
function set_remap() {
|
||||
case ${resp} in
|
||||
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
|
||||
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
|
||||
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
|
||||
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
|
||||
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Sata Disks
|
||||
SATADRIVES=0
|
||||
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
@@ -48,34 +31,34 @@ function getmap() {
|
||||
for file in drivesmax drivescon ports remap; do
|
||||
> "${TMP_PATH}/${file}"
|
||||
done
|
||||
|
||||
|
||||
DISKIDXMAPIDX=0
|
||||
DISKIDXMAP=""
|
||||
DISKIDXMAPIDXMAX=0
|
||||
DISKIDXMAPMAX=""
|
||||
|
||||
|
||||
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
|
||||
NUMPORTS=0
|
||||
CONPORTS=0
|
||||
declare -A HOSTPORTS
|
||||
|
||||
|
||||
while read -r LINE; do
|
||||
PORT=$(echo ${LINE} | grep -o 'ata[0-9]*' | sed 's/ata//')
|
||||
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
|
||||
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
|
||||
|
||||
|
||||
for PORT in $(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n); do
|
||||
ATTACH=$(ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && echo 1 || echo 0)
|
||||
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
|
||||
DUMMY=$([ ${PCMD} = 0 ] && echo 1 || echo 0)
|
||||
|
||||
|
||||
[ ${ATTACH} = 1 ] && CONPORTS=$((CONPORTS + 1)) && echo $((PORT - 1)) >>"${TMP_PATH}/ports"
|
||||
NUMPORTS=$((NUMPORTS + 1))
|
||||
done
|
||||
|
||||
|
||||
NUMPORTS=$((NUMPORTS > 8 ? 8 : NUMPORTS))
|
||||
CONPORTS=$((CONPORTS > 8 ? 8 : CONPORTS))
|
||||
|
||||
|
||||
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
|
||||
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
|
||||
DISKIDXMAP+=$(printf "%02x" $DISKIDXMAPIDX)
|
||||
@@ -87,16 +70,44 @@ function getmap() {
|
||||
fi
|
||||
|
||||
# SAS Disks
|
||||
detect_drives "107" "SASDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
|
||||
SASDRIVES=0
|
||||
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
SASDRIVES=$((SASDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# SCSI Disks
|
||||
detect_drives "100" "SCSIDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
|
||||
SCSIDRIVES=0
|
||||
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
SCSIDRIVES=$((SCSIDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# Raid Disks
|
||||
detect_drives "104" "RAIDDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
|
||||
RAIDDRIVES=0
|
||||
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
RAIDDRIVES=$((RAIDDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# NVMe Disks
|
||||
detect_drives "108" "NVMEDRIVES" "/sys/class/nvme" "\[N:${PORT}:" "s/nvme//"
|
||||
NVMEDRIVES=0
|
||||
if [ $(ls -l /sys/class/nvme 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
|
||||
PORTNUM=$(ls -l /sys/class/nvme | grep "${PCI}" | wc -l 2>/dev/null)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
NVMEDRIVES=$((NVMEDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# USB Disks
|
||||
USBDRIVES=0
|
||||
@@ -167,13 +178,8 @@ function getmapSelection() {
|
||||
REMAP1="*"
|
||||
fi
|
||||
|
||||
if [ "${STEP}" = "storagemap" ]; then
|
||||
show_dialog
|
||||
set_remap
|
||||
else
|
||||
show_dialog
|
||||
set_remap
|
||||
fi
|
||||
show_dialog
|
||||
set_remap
|
||||
else
|
||||
# Show recommended Option to user
|
||||
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
|
||||
@@ -46,21 +46,19 @@ PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
# Check if DSM Version changed
|
||||
. "${RAMDISK_PATH}/etc/VERSION"
|
||||
|
||||
if [[ -n "${PRODUCTVER}" && -n "${BUILDNUM}" && -n "${SMALLNUM}" ]] &&
|
||||
([[ "${PRODUCTVER}" != "${majorversion}.${minorversion}" ]] || [[ "${BUILDNUM}" != "${buildnumber}" ]] || [[ "${SMALLNUM}" != "${smallfixnumber}" ]]); then
|
||||
if [[ -n "${BUILDNUM}" && ("${PRODUCTVER}" != "${majorversion}.${minorversion}" || "${BUILDNUM}" != "${buildnumber}" || "${SMALLNUM}" != "${smallfixnumber}") ]]; then
|
||||
OLDVER="${PRODUCTVER}(${BUILDNUM}$([[ ${SMALLNUM:-0} -ne 0 ]] && echo "u${SMALLNUM}"))"
|
||||
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([[ ${smallfixnumber:-0} -ne 0 ]] && echo "u${smallfixnumber}"))"
|
||||
PAT_URL=""
|
||||
PAT_HASH=""
|
||||
echo "Version changed from ${OLDVER} to ${NEWVER}"
|
||||
echo "\nVersion changed from ${OLDVER} to ${NEWVER}"
|
||||
fi
|
||||
|
||||
[ "${PATURL:0:1}" = "#" ] && PATURL=""
|
||||
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
|
||||
|
||||
# Re-read PAT_URL and PAT_HASH if they are empty
|
||||
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
|
||||
# Re-read PAT_URL and PAT_HASH if they are empty or commented out
|
||||
if [[ -z "${PAT_URL}" || "${PAT_URL:0:1}" == "#" ]]; then
|
||||
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".url" "${D_FILE}")"
|
||||
fi
|
||||
if [[ -z "${PAT_HASH}" || "${PAT_HASH:0:1}" == "#" ]]; then
|
||||
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".hash" "${D_FILE}")"
|
||||
fi
|
||||
|
||||
@@ -120,14 +118,18 @@ for PATCH in "${PATCHES[@]}"; do
|
||||
done
|
||||
|
||||
# Add serial number to synoinfo.conf, to help to recover an installed DSM
|
||||
echo "Set synoinfo SN" >>"${LOG_FILE}"
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
{
|
||||
echo "Set synoinfo SN"
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" || exit 1
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" || exit 1
|
||||
} >>"${LOG_FILE}" 2>&1
|
||||
|
||||
for KEY in "${!SYNOINFO[@]}"; do
|
||||
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
{
|
||||
echo "Set synoinfo ${KEY}"
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" || exit 1
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" || exit 1
|
||||
} >>"${LOG_FILE}" 2>&1
|
||||
done
|
||||
|
||||
# Patch /sbin/init.post
|
||||
|
||||
82
img-ext.sh
82
img-ext.sh
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# Clean cached Files
|
||||
sudo git clean -fdx
|
||||
|
||||
. scripts/func.sh "${AUX_TOKEN}"
|
||||
|
||||
# Unmount Image File
|
||||
sudo umount "/tmp/p1" 2>/dev/null || true
|
||||
sudo umount "/tmp/p3" 2>/dev/null || true
|
||||
|
||||
# Get extractor, LKM, addons and Modules
|
||||
echo "Get Dependencies"
|
||||
getAddons "files/p3/addons"
|
||||
getModules "files/p3/modules"
|
||||
getConfigs "files/p3/configs"
|
||||
getPatches "files/p3/patches"
|
||||
getCustom "files/p3/custom"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
getOffline "files/p3/configs"
|
||||
mkdir -p "brx"
|
||||
[ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx"
|
||||
|
||||
# Sbase
|
||||
IMAGE_FILE="arc_create.img"
|
||||
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
||||
|
||||
echo "Mounting Image File"
|
||||
sudo rm -rf "/tmp/p1"
|
||||
sudo rm -rf "/tmp/p3"
|
||||
mkdir -p "/tmp/p1"
|
||||
mkdir -p "/tmp/p3"
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="13.3.7"
|
||||
ARC_BRANCH="extended"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
|
||||
echo "Repack initrd"
|
||||
if [ -f "brx/bzImage-arc" ] && [ -f "brx/initrd-arc" ]; then
|
||||
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
|
||||
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
sudo cp -rf "files/p3/"* "/tmp/p3"
|
||||
sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
sudo rm -rf "/tmp/p1"
|
||||
sudo rm -rf "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
# Resize Image
|
||||
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
|
||||
rm -f "${IMAGE_FILE}"
|
||||
|
||||
IMAGE_FILE="arc.img"
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
@@ -27,11 +27,16 @@ getCustom "files/p3/custom"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
getOffline "files/p3/configs"
|
||||
[ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs"
|
||||
case "${1}" in
|
||||
min) getBuildroot "${1}" "br" ;;
|
||||
ext) getBuildroot "${1}" "br" ;;
|
||||
micro) getBuildroot "${1}" "br" ;;
|
||||
*) echo "Invalid option specified" ;;
|
||||
esac
|
||||
|
||||
# Sbase
|
||||
IMAGE_FILE="arc_create.img"
|
||||
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
@@ -45,17 +50,18 @@ mkdir -p "/tmp/p3"
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
ARC_VERSION="13.3.7"
|
||||
ARC_BRANCH="minimal"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
ARC_BRANCH="dev"
|
||||
|
||||
for file in ARC_BUILD ARC_VERSION ARC_BRANCH; do
|
||||
echo "${!file}" > "files/p1/${file}"
|
||||
done
|
||||
|
||||
echo "Repack initrd"
|
||||
if [ -f "brs/bzImage-arc" ] && [ -f "brs/initrd-arc" ]; then
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
if [ -f "br/bzImage-arc" ] && [ -f "br/initrd-arc" ]; then
|
||||
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
|
||||
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@@ -73,9 +79,4 @@ sudo rm -rf "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
# Resize Image
|
||||
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
|
||||
rm -f "${IMAGE_FILE}"
|
||||
|
||||
IMAGE_FILE="arc.img"
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
136
scripts/func.sh
136
scripts/func.sh
@@ -185,73 +185,51 @@ function getTheme() {
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Buildroot-X
|
||||
# $1 path
|
||||
function getBuildrootx() {
|
||||
echo "Getting Buildroot-X begin"
|
||||
local DEST_PATH="${1}"
|
||||
# Get latest Buildroot
|
||||
# $1 type (min for S, ext for X, micro for M)
|
||||
# $2 path
|
||||
function getBuildroot() {
|
||||
local TYPE="${1}"
|
||||
local DEST_PATH="${2}"
|
||||
local REPO=""
|
||||
local ZIP_NAME=""
|
||||
local TAG_VAR=""
|
||||
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export BRXTAG="${TAG}"
|
||||
case "${TYPE}" in
|
||||
min)
|
||||
REPO="arc-buildroot-s"
|
||||
TAG_VAR="BRSTAG"
|
||||
;;
|
||||
ext)
|
||||
REPO="arc-buildroot-x"
|
||||
TAG_VAR="BRXTAG"
|
||||
;;
|
||||
micro)
|
||||
REPO="arc-buildroot-m"
|
||||
TAG_VAR="BRMTAG"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid type specified"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Getting Buildroot-${TYPE} begin"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export ${TAG_VAR}="${TAG}"
|
||||
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
|
||||
rm -f "${DEST_PATH}/bzImage-arc"
|
||||
rm -f "${DEST_PATH}/initrd-arc"
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/assets/${ID}" -o "${DEST_PATH}/brx.zip"
|
||||
echo "Buildroot-X: ${TAG}"
|
||||
unzip -o "${DEST_PATH}/brx.zip" -d "${DEST_PATH}"
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/assets/${ID}" -o "${DEST_PATH}/br.zip"
|
||||
echo "Buildroot-${TYPE}: ${TAG}"
|
||||
unzip -o "${DEST_PATH}/br.zip" -d "${DEST_PATH}"
|
||||
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Buildroot-S
|
||||
# $1 path
|
||||
function getBuildroots() {
|
||||
echo "Getting Buildroot-S begin"
|
||||
local DEST_PATH="${1}"
|
||||
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export BRSTAG="${TAG}"
|
||||
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
|
||||
rm -f "${DEST_PATH}/bzImage-arc"
|
||||
rm -f "${DEST_PATH}/initrd-arc"
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/assets/${ID}" -o "${DEST_PATH}/brs.zip"
|
||||
echo "Buildroot-S: ${TAG}"
|
||||
unzip -o "${DEST_PATH}/brs.zip" -d "${DEST_PATH}"
|
||||
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Buildroot-M
|
||||
# $1 path
|
||||
function getBuildrootm() {
|
||||
echo "Getting Buildroot-M begin"
|
||||
local DEST_PATH="${1}"
|
||||
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export BRSTAG="${TAG}"
|
||||
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
|
||||
rm -f "${DEST_PATH}/bzImage-arc"
|
||||
rm -f "${DEST_PATH}/initrd-arc"
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/assets/${ID}" -o "${DEST_PATH}/brm.zip"
|
||||
echo "Buildroot-M: ${TAG}"
|
||||
unzip -o "${DEST_PATH}/brm.zip" -d "${DEST_PATH}"
|
||||
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Offline
|
||||
@@ -317,36 +295,46 @@ function repackInitrd() {
|
||||
sudo rm -rf "${RDXZ_PATH}"
|
||||
}
|
||||
|
||||
# resizeimg
|
||||
# resizeImg
|
||||
# $1 input file
|
||||
# $2 changsize MB eg: +50M -50M
|
||||
# $2 change size MB e.g., +50M -50M
|
||||
# $3 output file
|
||||
function resizeImg() {
|
||||
INPUT_FILE="${1}"
|
||||
CHANGE_SIZE="${2}"
|
||||
OUTPUT_FILE="${3:-${INPUT_FILE}}"
|
||||
local INPUT_FILE="${1}"
|
||||
local CHANGE_SIZE="${2}"
|
||||
local OUTPUT_FILE="${3:-${INPUT_FILE}}"
|
||||
|
||||
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
|
||||
[ -z "${CHANGE_SIZE}" ] && exit 1
|
||||
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && { echo "Input file not specified or does not exist"; exit 1; }
|
||||
[[ -z "${CHANGE_SIZE}" ]] && { echo "Change size not specified"; exit 1; }
|
||||
|
||||
INPUT_FILE="$(realpath "${INPUT_FILE}")"
|
||||
OUTPUT_FILE="$(realpath "${OUTPUT_FILE}")"
|
||||
|
||||
local CURRENT_SIZE
|
||||
CURRENT_SIZE=$(du -m "${INPUT_FILE}" | awk '{print $1}')
|
||||
local SIZE
|
||||
SIZE=$((CURRENT_SIZE + ${CHANGE_SIZE//M/}))
|
||||
|
||||
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
|
||||
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && exit 1
|
||||
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && { echo "Invalid size calculated"; exit 1; }
|
||||
|
||||
if [ ! "${INPUT_FILE}" = "${OUTPUT_FILE}" ]; then
|
||||
if [[ "${INPUT_FILE}" != "${OUTPUT_FILE}" ]]; then
|
||||
sudo cp -f "${INPUT_FILE}" "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
sudo truncate -s ${SIZE}M "${OUTPUT_FILE}"
|
||||
echo -e "d\n\nn\n\n\n\n\nn\nw" | sudo fdisk "${OUTPUT_FILE}"
|
||||
sudo truncate -s "${SIZE}M" "${OUTPUT_FILE}"
|
||||
|
||||
# Use `parted` to resize partition 3
|
||||
sudo parted "${OUTPUT_FILE}" --script -- resizepart 3 "${SIZE}M"
|
||||
|
||||
local LOOPX
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P ${LOOPX} "${OUTPUT_FILE}"
|
||||
sudo e2fsck -fp $(ls ${LOOPX}* | sort -n | tail -1)
|
||||
sudo resize2fs $(ls ${LOOPX}* | sort -n | tail -1)
|
||||
sudo losetup -d ${LOOPX}
|
||||
sudo losetup -P "${LOOPX}" "${OUTPUT_FILE}"
|
||||
local PARTITION
|
||||
PARTITION=$(ls "${LOOPX}p3")
|
||||
sudo e2fsck -fp "${PARTITION}"
|
||||
sudo tune2fs -l "${PARTITION}" | grep "Block size"
|
||||
sudo resize2fs "${PARTITION}"
|
||||
sudo losetup -d "${LOOPX}"
|
||||
}
|
||||
|
||||
# createvmx
|
||||
@@ -522,4 +510,4 @@ function copyBuildroot() {
|
||||
mkdir -p "${DEST_PATH}"
|
||||
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ done
|
||||
popd
|
||||
|
||||
rm -f grub.img
|
||||
dd if=/dev/zero of=grub.img bs=1M seek=1024 count=0
|
||||
dd if=/dev/zero of=grub.img bs=1M seek=2048 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
|
||||
|
||||
@@ -71,4 +71,4 @@ sudo umount ${LOOPX}p1
|
||||
sudo losetup -d ${LOOPX}
|
||||
sudo rm -rf ${NAME}1
|
||||
|
||||
gzip grub.img
|
||||
gzip grub.img
|
||||
|
||||
Reference in New Issue
Block a user