Compare commits
79 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97187e457 | ||
|
|
c041a9d201 | ||
|
|
e30dcd5a93 | ||
|
|
1392db0e26 | ||
|
|
e8832fbc11 | ||
|
|
a1966daf4a | ||
|
|
9b2f7b6f89 | ||
|
|
04dbb73570 | ||
|
|
68187e2f05 | ||
|
|
fbc5ce8073 | ||
|
|
9985b68556 | ||
|
|
1886c8763a | ||
|
|
039a663457 | ||
|
|
e962c7201f | ||
|
|
3152124fd0 | ||
|
|
cdfb0cc6bd | ||
|
|
23749d7a95 | ||
|
|
70ee266d78 | ||
|
|
ba6a125798 | ||
|
|
0b5c80cb6a | ||
|
|
1b7bb3078e | ||
|
|
012e825d96 | ||
|
|
f571cae9ba | ||
|
|
bab144cfe0 | ||
|
|
d8db7bbbab | ||
|
|
e084f9c225 | ||
|
|
eec2393740 | ||
|
|
5147002d0d | ||
|
|
b23b551d2e | ||
|
|
9c654b8661 | ||
|
|
4b07877e50 | ||
|
|
7d2583aa68 | ||
|
|
2133cc94c6 | ||
|
|
9cef565971 | ||
|
|
4e40d54f2d | ||
|
|
abfabee34a | ||
|
|
faf340458c | ||
|
|
7c432898f5 | ||
|
|
1923b4774d | ||
|
|
e297f7ccfe | ||
|
|
3cfa988a15 | ||
|
|
9a66f15f1d | ||
|
|
48b1443974 | ||
|
|
a405764fe9 | ||
|
|
e552595b99 | ||
|
|
868443164e | ||
|
|
9e688e76ce | ||
|
|
60d71dca4f | ||
|
|
090c29d589 | ||
|
|
7f4d124f9c | ||
|
|
1d0adb6b61 | ||
|
|
99e9f13ae9 | ||
|
|
5db6c8499d | ||
|
|
46bed3f449 | ||
|
|
3ff54fa893 | ||
|
|
dba6e0c373 | ||
|
|
c4221d93d8 | ||
|
|
78cb49b655 | ||
|
|
10933e8cae | ||
|
|
122dc5a874 | ||
|
|
45e99341eb | ||
|
|
b50dc273cc | ||
|
|
b2a31744a9 | ||
|
|
731ffd710c | ||
|
|
276b21d130 | ||
|
|
d202bf3565 | ||
|
|
b107c77d29 | ||
|
|
e608b32e3b | ||
|
|
20caa713eb | ||
|
|
6bcf451e77 | ||
|
|
cd16e7f011 | ||
|
|
990a6cb03a | ||
|
|
971331188b | ||
|
|
8407ed1482 | ||
|
|
9c15548d34 | ||
|
|
5568b4f0b4 | ||
|
|
03a48fbd14 | ||
|
|
0d5107e8cd | ||
|
|
e9daed7143 |
274
.github/workflows/autobuild.yml
vendored
274
.github/workflows/autobuild.yml
vendored
@@ -1,274 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
name: Build Arc Image Development
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
runs:
|
||||
description: "runs-on"
|
||||
type: choice
|
||||
options:
|
||||
- ubuntu-latest
|
||||
- self-hosted
|
||||
version:
|
||||
description: "version (1.0.0)"
|
||||
required: true
|
||||
type: string
|
||||
next:
|
||||
description: "next"
|
||||
default: true
|
||||
type: boolean
|
||||
stable:
|
||||
description: "stable"
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.runs }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@main
|
||||
|
||||
# Install Dependencies
|
||||
- name: Install Dependencies
|
||||
if: ${{ inputs.runs == 'ubuntu-latest' }}
|
||||
run: |
|
||||
git config --global user.email "info@auxxxilium.tech"
|
||||
git config --global user.name "AuxXxilium"
|
||||
sudo timedatectl set-timezone "Europe/Berlin"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
|
||||
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
||||
# sudo snap install yq
|
||||
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
|
||||
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
|
||||
fi
|
||||
|
||||
df -h
|
||||
|
||||
# Get extractor, LKM, Addons, Modules, Theme and Configs
|
||||
- name: Get Buildroot
|
||||
run: |
|
||||
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
|
||||
|
||||
echo "Get Dependencies"
|
||||
getAddons "files/p3/addons"
|
||||
getModules "files/p3/modules"
|
||||
getConfigs "files/p3/configs"
|
||||
getPatches "files/p3/patches"
|
||||
getCustom "files/p3/custom"
|
||||
getOffline "files/p3/configs"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
|
||||
# Export Dependencies Version to env
|
||||
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
||||
echo "MODULETAG=${MODULETAG}" >> $GITHUB_ENV
|
||||
echo "CONFIGTAG=${CONFIGTAG}" >> $GITHUB_ENV
|
||||
echo "PATCHTAG=${PATCHTAG}" >> $GITHUB_ENV
|
||||
echo "CUSTOMTAG=${CUSTOMTAG}" >> $GITHUB_ENV
|
||||
echo "LKMTAG=${LKMTAG}" >> $GITHUB_ENV
|
||||
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
|
||||
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
|
||||
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
|
||||
|
||||
echo "OK"
|
||||
|
||||
# Build incremental
|
||||
- name: Build Next Image
|
||||
if: ${{ inputs.next == true }}
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
getBuildrootx "brx"
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="${{ inputs.version }}-dev"
|
||||
ARC_BRANCH="next"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
||||
|
||||
echo "Mounting Image File"
|
||||
mkdir -p "/tmp/p1"
|
||||
mkdir -p "/tmp/p3"
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
[ ! -f "brx/bzImage-arc" ] || [ ! -f "brx/initrd-arc" ] && return 1
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
|
||||
createArc
|
||||
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
sudo cp -rf "files/p3/"* "/tmp/p3"
|
||||
sudo sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
rmdir "/tmp/p1"
|
||||
rmdir "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
echo "Image Converter"
|
||||
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
|
||||
|
||||
echo "Create Arc vhd"
|
||||
createvmc "arc.vmc"
|
||||
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
|
||||
|
||||
echo "Create Arc ova"
|
||||
convertova "${IMAGE_FILE}" "arc.ova"
|
||||
|
||||
# Zip image and generate checksum
|
||||
- name: Pack Next Image
|
||||
if: ${{ inputs.next == true }}
|
||||
run: |
|
||||
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhdx.zip" arc.vhdx
|
||||
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
- name: Cleanup
|
||||
run: |
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc"
|
||||
|
||||
# Build incremental
|
||||
- name: Build Stable Image
|
||||
if: ${{ inputs.stable }}
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
getBuildroots "brs"
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="${{ inputs.version }}-dev"
|
||||
ARC_BRANCH="stable"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc.img"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
||||
|
||||
echo "Mounting Image File"
|
||||
mkdir -p "/tmp/p1"
|
||||
mkdir -p "/tmp/p3"
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
[ ! -f "brs/bzImage-arc" ] || [ ! -f "brs/initrd-arc" ] && return 1
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
createArc
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
sudo cp -rf "files/p3/"* "/tmp/p3"
|
||||
sudo sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
rmdir "/tmp/p1"
|
||||
rmdir "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
echo "Image Converter"
|
||||
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
|
||||
|
||||
echo "Create Arc vhd"
|
||||
createvmc "arc.vmc"
|
||||
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
|
||||
|
||||
echo "Create Arc ova"
|
||||
convertova "${IMAGE_FILE}" "arc.ova"
|
||||
|
||||
# Zip image and generate checksum
|
||||
- name: Pack Stable Image
|
||||
if: ${{ inputs.stable }}
|
||||
run: |
|
||||
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhdx.zip" arc.vhdx
|
||||
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
|
||||
fi
|
||||
|
||||
# Publish a release if is a tag
|
||||
- name: Release
|
||||
if: success() && env.ARC_VERSION != ''
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ env.ARC_VERSION }}
|
||||
prerelease: true
|
||||
makeLatest: false
|
||||
allowUpdates: true
|
||||
body: |
|
||||
### Note:
|
||||
- Development Build
|
||||
|
||||
### Information:
|
||||
- Full Changelog is available in my Discord
|
||||
- Discord Account for Arc Patch needed
|
||||
|
||||
### Dependencies:
|
||||
- Addons: ${{ env.ADDONTAG }}
|
||||
- Modules: ${{ env.MODULETAG }}
|
||||
- Configs: ${{ env.CONFIGTAG }}
|
||||
- Patches: ${{ env.PATCHTAG }}
|
||||
- Custom: ${{ env.CUSTOMTAG }}
|
||||
- LKMs: ${{ env.LKMTAG }}
|
||||
- Buildroot Stable: ${{ env.BRSTAG }}
|
||||
- Buildroot Next: ${{ env.BRXTAG }}
|
||||
|
||||
### Release
|
||||
- ${{ env.BUILD_TIME }}
|
||||
artifacts: |
|
||||
arc-*.zip
|
||||
update-*.zip
|
||||
136
.github/workflows/build.yml
vendored
136
.github/workflows/build.yml
vendored
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
|
||||
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
@@ -32,14 +32,6 @@ on:
|
||||
description: "pre release"
|
||||
default: false
|
||||
type: boolean
|
||||
next:
|
||||
description: "next"
|
||||
default: true
|
||||
type: boolean
|
||||
stable:
|
||||
description: "stable"
|
||||
default: true
|
||||
type: boolean
|
||||
clean:
|
||||
description: "clean"
|
||||
default: false
|
||||
@@ -60,7 +52,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
|
||||
@@ -94,9 +86,7 @@ jobs:
|
||||
getOffline "files/p3/configs"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
getBuildrootx "brx"
|
||||
getBuildroots "brs"
|
||||
cp -f "files/initrd/opt/arc/grub.img.gz" "grub.img.gz"
|
||||
getBuildroot "evo" "br"
|
||||
|
||||
# Export Dependencies Version to env
|
||||
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
||||
@@ -106,32 +96,29 @@ jobs:
|
||||
echo "CUSTOMTAG=${CUSTOMTAG}" >> $GITHUB_ENV
|
||||
echo "LKMTAG=${LKMTAG}" >> $GITHUB_ENV
|
||||
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
|
||||
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
|
||||
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
|
||||
echo "BRTAG=${BRTAG}" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
|
||||
|
||||
echo "OK"
|
||||
|
||||
# Build incremental
|
||||
- name: Build Next Image
|
||||
if: ${{ inputs.next }}
|
||||
- name: Build Image
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_BUILD="$(date +'%y%m%d')"
|
||||
ARC_VERSION="${{ inputs.version }}"
|
||||
ARC_BRANCH="next"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
ARC_BRANCH="evo"
|
||||
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.img"
|
||||
cp -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
@@ -144,12 +131,11 @@ jobs:
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
[ ! -f "brx/bzImage-arc" ] || [ ! -f "brx/initrd-arc" ] && return 1
|
||||
[ ! -f "br/bzImage-arc" ] || [ ! -f "br/initrd-arc" ] && return 1
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
|
||||
createArc
|
||||
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
|
||||
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
@@ -176,90 +162,7 @@ jobs:
|
||||
convertova "${IMAGE_FILE}" "arc.ova"
|
||||
|
||||
# Zip image and generate checksum
|
||||
- name: Pack Next Image
|
||||
if: ${{ inputs.next }}
|
||||
run: |
|
||||
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhd.zip" arc.vhd arc.vmc
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.ova.zip" arc.ova
|
||||
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
|
||||
sha256sum update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip >"update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.hash"
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
- name: Cleanup
|
||||
run: |
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc"
|
||||
|
||||
# Build incremental
|
||||
- name: Build Stable Image
|
||||
if: ${{ inputs.stable }}
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="${{ inputs.version }}"
|
||||
ARC_BRANCH="stable"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
|
||||
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
|
||||
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
|
||||
|
||||
echo "Create Arc Image"
|
||||
IMAGE_FILE="arc.img"
|
||||
cp -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
|
||||
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
|
||||
fdisk -l "${IMAGE_FILE}"
|
||||
|
||||
LOOPX=$(sudo losetup -f)
|
||||
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
||||
|
||||
echo "Mounting Image File"
|
||||
mkdir -p "/tmp/p1"
|
||||
mkdir -p "/tmp/p3"
|
||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
[ ! -f "brs/bzImage-arc" ] || [ ! -f "brs/initrd-arc" ] && return 1
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
createArc
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
sudo cp -rf "files/p3/"* "/tmp/p3"
|
||||
sudo sync
|
||||
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
rmdir "/tmp/p1"
|
||||
rmdir "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
echo "Image Converter"
|
||||
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
|
||||
|
||||
echo "Create Arc vhd"
|
||||
createvmc "arc.vmc"
|
||||
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
|
||||
|
||||
echo "Create Arc ova"
|
||||
convertova "${IMAGE_FILE}" "arc.ova"
|
||||
|
||||
# Zip image and generate checksum
|
||||
- name: Pack Stable Image
|
||||
if: ${{ inputs.stable }}
|
||||
- name: Pack Image
|
||||
run: |
|
||||
if [ -n "${{ env.ARC_VERSION }}" ]; then
|
||||
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
|
||||
@@ -285,12 +188,9 @@ jobs:
|
||||
- ${{ inputs.notice }}
|
||||
|
||||
### Information:
|
||||
- Changelog is available in my Discord
|
||||
- Discord Account for Arc Patch needed
|
||||
|
||||
### Versions:
|
||||
${{ inputs.stable && '- Stable: Full Image, all dependencies are included, reduced hardware support (if there is a Next image)' || '' }}
|
||||
${{ inputs.next && '- Next: Full Image, all dependencies are included, more hardware support, new features to test' || '' }}
|
||||
- Changelog is available in my Discord
|
||||
- Based on VisionZ Evolution Code Base
|
||||
|
||||
### Dependencies:
|
||||
- Addons: ${{ env.ADDONTAG }}
|
||||
@@ -299,11 +199,11 @@ jobs:
|
||||
- Patches: ${{ env.PATCHTAG }}
|
||||
- Custom: ${{ env.CUSTOMTAG }}
|
||||
- LKMs: ${{ env.LKMTAG }}
|
||||
${{ inputs.stable && format('- Buildroot Stable: {0}', env.BRSTAG) || '' }}
|
||||
${{ inputs.next && format('- Buildroot Next: {0}', env.BRXTAG) || '' }}
|
||||
- Basesystem: ${{ env.BRTAG }}
|
||||
|
||||
### Release
|
||||
- ${{ env.BUILD_TIME }}
|
||||
artifacts: |
|
||||
arc-*.zip
|
||||
update-*.zip
|
||||
update-*.hash
|
||||
|
||||
76
.github/workflows/custom.yml
vendored
76
.github/workflows/custom.yml
vendored
@@ -161,64 +161,41 @@ jobs:
|
||||
|
||||
cp -f "${IMAGE_FILE}" "arc.img"
|
||||
|
||||
if [ "${{ env.FORMAT }}" = "dyn" ]; then
|
||||
# Zip image and generate checksum
|
||||
- name: Convert & Pack
|
||||
run: |
|
||||
rm -rf arc-*.zip 2>/dev/null
|
||||
if [ "${{ env.FORMAT }}" = "img" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
|
||||
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
|
||||
echo "Image Converter -> dyn"
|
||||
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,compat6 arc-dyn.vmdk
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
|
||||
elif [ "${{ env.FORMAT }}" = "flat" ]; then
|
||||
echo "Image Converter -> flat"
|
||||
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat,compat6 arc.vmdk
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
||||
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
|
||||
echo "Image Converter -> vhdx"
|
||||
qemu-img convert arc.img -O vhdx -o subformat=dynamic arc.vhdx
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
|
||||
elif [ "${{ env.FORMAT }}" = "ova" ]; then
|
||||
echo "Image Converter -> ova"
|
||||
convertova "arc.img" "arc.ova"
|
||||
fi
|
||||
|
||||
# Zip image and generate checksum
|
||||
- name: Pack
|
||||
run: |
|
||||
if [ "${{ env.FORMAT }}" = "img" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
|
||||
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" "https://file.io")"
|
||||
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
||||
echo "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
|
||||
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" "https://file.io")"
|
||||
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
||||
echo "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${{ env.FORMAT }}" = "flat" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
||||
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" "https://file.io")"
|
||||
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
||||
echo "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
|
||||
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" "https://file.io")"
|
||||
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
||||
echo "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${{ env.FORMAT }}" = "ova" ]; then
|
||||
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" arc.ova
|
||||
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" "https://file.io")"
|
||||
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
||||
echo "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.ACTION }}" "https://api.github.com/users/${{ github.event.issue.user.login }}" | jq -r '.email')
|
||||
FIOURL="$(echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+')"
|
||||
echo "EMAIL=${EMAIL}" >> $GITHUB_ENV
|
||||
echo "FIOURL=${FIOURL}" >> $GITHUB_ENV
|
||||
|
||||
# Upload artifact
|
||||
- name: Upload to Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: arc-${{ env.MODEL }}-${{ env.VERSION }}-${{ github.run_id }}
|
||||
path: |
|
||||
arc-*.zip
|
||||
retention-days: 1
|
||||
|
||||
- name: Send mail
|
||||
if: success() && env.EMAIL != 'null'
|
||||
@@ -232,7 +209,12 @@ jobs:
|
||||
to: ${{ env.EMAIL }}
|
||||
from: ${{ secrets.MAIL_USERNAME }}
|
||||
body: |
|
||||
${{ env.FIOURL }}
|
||||
Hi @${{ github.event.issue.user.login }}.
|
||||
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download:
|
||||
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
If this isn't working, do not use customized Versions!
|
||||
----
|
||||
|
||||
- name: Update Comment Success
|
||||
if: success()
|
||||
@@ -244,10 +226,10 @@ jobs:
|
||||
update-mode: replace
|
||||
body: |
|
||||
Hi @${{ github.event.issue.user.login }}.
|
||||
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download: ${{ env.FIOURL }}
|
||||
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download:
|
||||
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
If this will not work, do not use customized Versions!
|
||||
If this isn't working, do not use customized Versions!
|
||||
----
|
||||
|
||||
- name: Update Comment Fail
|
||||
@@ -260,10 +242,8 @@ jobs:
|
||||
update-mode: replace
|
||||
body: |
|
||||
Hi @${{ github.event.issue.user.login }}.
|
||||
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again.
|
||||
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again later.
|
||||
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
|
||||
If this will not work, do not use customized Versions!
|
||||
----
|
||||
|
||||
- name: Close Issues
|
||||
|
||||
11
.github/workflows/grub.yml
vendored
11
.github/workflows/grub.yml
vendored
@@ -28,20 +28,19 @@ jobs:
|
||||
sudo timedatectl set-timezone "Europe/Berlin"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y autoconf automake autopoint gettext build-essential bison flex libtool dosfstools e2fsprogs
|
||||
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev liblzma-dev libzfslinux-dev
|
||||
sudo apt install -y autoconf automake autopoint build-essential pkg-config bison flex gettext gawk libtool dosfstools e2fsprogs
|
||||
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev libzfslinux-dev liblzma-dev libdevmapper-dev
|
||||
|
||||
- name: Make Grub
|
||||
run: |
|
||||
. scripts/grub.sh "grub-2.12" "i386-pc i386-efi x86_64-efi"
|
||||
rm -f grub.img.gz
|
||||
. scripts/grub.sh "grub-2.12" "i386-pc i386-efi x86_64-efi" "ARC"
|
||||
|
||||
- name: Check and Push
|
||||
if: success() && inputs.push == true
|
||||
run: |
|
||||
if [ -f "grub.img.gz" ]; then
|
||||
echo "Copy img ..."
|
||||
mv -f grub.img.gz files/initrd/opt/arc/grub.img.gz
|
||||
|
||||
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}')
|
||||
|
||||
@@ -3,17 +3,11 @@
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
build-img-n:
|
||||
build-evo:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-gen-n.sh
|
||||
|
||||
build-img-s:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-gen-s.sh
|
||||
- ./img-gen.sh evo
|
||||
|
||||
compile-kpatch:
|
||||
dir: kpatch
|
||||
|
||||
@@ -39,58 +39,47 @@ 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
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Permit user select the modules to include
|
||||
function modulesMenu() {
|
||||
NEXT="1"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
@@ -708,23 +697,20 @@ function backupMenu() {
|
||||
if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ] && [ "${CONFDONE}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore HW Encryption Key from DSM" \
|
||||
3 "Backup HW Encryption Key to DSM" \
|
||||
4 "Restore Arc Config from Online" \
|
||||
5 "Backup Arc Config to Online" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
3 "Restore Arc Config from Online" \
|
||||
4 "Backup Arc Config to Online" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
elif [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore HW Encryption Key from DSM" \
|
||||
3 "Backup HW Encryption Key to DSM" \
|
||||
4 "Restore Arc Config from Online" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
3 "Restore Arc Config from Online" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \
|
||||
1 "Restore Arc Config from DSM" \
|
||||
2 "Restore HW Encryption Key from DSM" \
|
||||
3 "Backup HW Encryption Key to DSM" \
|
||||
2 "Restore Hardware Key from DSM" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
fi
|
||||
[ $? -ne 0 ] && break
|
||||
@@ -811,38 +797,6 @@ function backupMenu() {
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
BACKUPKEY="false"
|
||||
DSMROOTS="$(findDSMRoot)"
|
||||
if [ -z "${DSMROOTS}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \
|
||||
--msgbox "No DSM system partition(md0) found!\nPlease insert all disks before continuing." 0 0
|
||||
return
|
||||
fi
|
||||
(
|
||||
mkdir -p "${TMP_PATH}/mdX"
|
||||
for I in ${DSMROOTS}; do
|
||||
# fixDSMRootPart "${I}"
|
||||
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
|
||||
[ $? -ne 0 ] && continue
|
||||
if [ -f "${PART2_PATH}/machine.key" ]; then
|
||||
cp -f "${PART2_PATH}/machine.key" "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key"
|
||||
BACKUPKEY="true"
|
||||
sync
|
||||
fi
|
||||
umount "${TMP_PATH}/mdX"
|
||||
done
|
||||
rm -rf "${TMP_PATH}/mdX" >/dev/null
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \
|
||||
--progressbox "Backup Encryption Key ..." 20 70
|
||||
if [ "${BACKUPKEY}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \
|
||||
--msgbox "Encryption Key backup successful!" 0 0
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \
|
||||
--msgbox "No Encryption Key found!" 0 0
|
||||
fi
|
||||
;;
|
||||
4)
|
||||
[ -f "${USER_CONFIG_FILE}" ] && mv -f "${USER_CONFIG_FILE}" "${USER_CONFIG_FILE}.bak"
|
||||
HWID="$(genHWID)"
|
||||
if curl -skL "https://arc.auxxxilium.tech?cdown=${HWID}" -o "${USER_CONFIG_FILE}" 2>/dev/null; then
|
||||
@@ -873,7 +827,7 @@ function backupMenu() {
|
||||
sleep 2
|
||||
rm -f "${HOME}/.initialized" && exec init.sh
|
||||
;;
|
||||
5)
|
||||
4)
|
||||
HWID="$(genHWID)"
|
||||
curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -897,8 +851,8 @@ function updateMenu() {
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --title "Update" --colors --cancel-label "Exit" \
|
||||
--menu "Choose an Option" 0 0 0 \
|
||||
1 "Update Loader \Z1(no reflash)\Zn" \
|
||||
2 "Update Dependencies" \
|
||||
1 "Update Full Loader \Z1(no reflash)\Zn" \
|
||||
2 "Update Dependencies (only integrated Parts)" \
|
||||
3 "Update Configs and Arc Patch" \
|
||||
4 "Switch Arc Branch: \Z1${ARC_BRANCH}\Zn" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
@@ -936,17 +890,14 @@ function updateMenu() {
|
||||
4)
|
||||
dialog --backtitle "$(backtitle)" --title "Switch Arc Branch" \
|
||||
--menu "Choose a Branch" 0 0 0 \
|
||||
1 "stable - Less Hardware support / faster Boot" \
|
||||
2 "next - More Hardware support / slower Boot" \
|
||||
3 "dev - Development only" \
|
||||
1 "evolution - Stable System" \
|
||||
3 "dev - Development System" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
ARC_BRANCH="stable"
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
ARC_BRANCH="next"
|
||||
elif [ ${opts} -eq 3 ]; then
|
||||
ARC_BRANCH="dev"
|
||||
fi
|
||||
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
|
||||
@@ -991,9 +942,10 @@ function sysinfo() {
|
||||
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
||||
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
|
||||
CPU="$(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}')"
|
||||
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
|
||||
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
|
||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
ETHN=$(echo ${ETHX} | wc -w)
|
||||
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
HWID="$(genHWID)"
|
||||
@@ -1037,9 +989,8 @@ function sysinfo() {
|
||||
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")"
|
||||
PATCHESVERSION="$(cat "${PATCH_PATH}/VERSION")"
|
||||
TIMEOUT=5
|
||||
TEXT=""
|
||||
# Print System Informations
|
||||
TEXT+="\n\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn"
|
||||
TEXT="\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn"
|
||||
TEXT+="\n Vendor: \Zb${VENDOR}\Zn"
|
||||
TEXT+="\n CPU: \Zb${CPU}\Zn"
|
||||
if [ $(lspci -d ::300 | wc -l) -gt 0 ]; then
|
||||
@@ -1051,35 +1002,36 @@ function sysinfo() {
|
||||
fi
|
||||
TEXT+="\n Memory: \Zb$((${RAMTOTAL}))GB\Zn"
|
||||
TEXT+="\n AES | ACPI: \Zb${AESSYS} | ${ACPISYS}\Zn"
|
||||
TEXT+="\n CPU Scaling: \Zb${CPUFREQ}\Zn"
|
||||
TEXT+="\n CPU Scaling | Governor: \Zb${CPUFREQ} | ${GOVERNOR}\Zn"
|
||||
TEXT+="\n Secure Boot: \Zb${SECURE}\Zn"
|
||||
TEXT+="\n Bootdisk: \Zb${LOADER_DISK}\Zn"
|
||||
TEXT+="\n"
|
||||
TEXT+="\n\Z4> Network: ${ETHN} NIC\Zn"
|
||||
for N in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
DRIVER="$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')"
|
||||
MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
while true; do
|
||||
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
TEXT+="\n ${DRIVER}: \ZbDOWN\Zn"
|
||||
TEXT+="\n ${DRIVER} (${MAC}): \ZbDOWN\Zn"
|
||||
break
|
||||
fi
|
||||
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
TEXT+="\n ${DRIVER}: \ZbNOT CONNECTED\Zn"
|
||||
TEXT+="\n ${DRIVER} (${MAC}): \ZbNOT CONNECTED\Zn"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${TIMEOUT} ]; then
|
||||
TEXT+="\n ${DRIVER}: \ZbTIMEOUT\Zn"
|
||||
TEXT+="\n ${DRIVER} (${MAC}): \ZbTIMEOUT\Zn"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 1))
|
||||
IP="$(getIP "${N}")"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
SPEED="$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')"
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
TEXT+="\n ${DRIVER} (${SPEED}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
|
||||
TEXT+="\n ${DRIVER} (${SPEED} | ${MAC}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
|
||||
else
|
||||
TEXT+="\n ${DRIVER} (${SPEED}): \Zb${IP}\Zn"
|
||||
TEXT+="\n ${DRIVER} (${SPEED} | ${MAC}): \Zb${IP}\Zn"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
@@ -1284,7 +1236,7 @@ function uploadDiag () {
|
||||
# Shows Networkdiag to user
|
||||
function networkdiag() {
|
||||
(
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
for N in ${ETHX}; do
|
||||
echo
|
||||
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
@@ -1362,12 +1314,12 @@ function credits() {
|
||||
TEXT+="\n"
|
||||
TEXT+="\n\Z4>> Developer:\Zn"
|
||||
TEXT+="\n Arc Loader: \ZbAuxXxilium / Fulcrum\Zn"
|
||||
TEXT+="\n Arc Evo Base: \ZbVisionZ\Zn"
|
||||
TEXT+="\n"
|
||||
TEXT+="\n\Z4>> Based on:\Zn"
|
||||
TEXT+="\n Redpill: \ZbTTG / Pocopico\Zn"
|
||||
TEXT+="\n ARPL/RR: \Zbfbelavenuto / wjz304\Zn"
|
||||
TEXT+="\n Others: \Zb007revad / more...\Zn"
|
||||
TEXT+="\n System: \ZbBuildroot\Zn"
|
||||
TEXT+="\n Others: \Zb007revad / PeterSuh-Q3 / more...\Zn"
|
||||
TEXT+="\n DSM: \ZbSynology Inc.\Zn"
|
||||
TEXT+="\n"
|
||||
TEXT+="\n\Z4>> Note:\Zn"
|
||||
@@ -1388,7 +1340,7 @@ function credits() {
|
||||
###############################################################################
|
||||
# Setting Static IP for Loader
|
||||
function staticIPMenu() {
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
IPCON=""
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
|
||||
@@ -2127,7 +2079,7 @@ function rebootMenu() {
|
||||
echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/opts"
|
||||
fi
|
||||
echo -e "bios \"System: BIOS/UEFI\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "uefi \"System: UEFI\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "poweroff \"System: Shutdown\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "shell \"System: Shell Cmdline\"" >>"${TMP_PATH}/opts"
|
||||
dialog --backtitle "$(backtitle)" --title "Power Menu" \
|
||||
@@ -2234,26 +2186,20 @@ function governorMenu () {
|
||||
function governorSelection () {
|
||||
rm -f "${TMP_PATH}/opts" >/dev/null
|
||||
touch "${TMP_PATH}/opts"
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Selectable CPU governors
|
||||
[ "${PLATFORM}" = "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency *\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && echo -e "conservative \"use conservative to scale frequency\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/opts"
|
||||
dialog --backtitle "$(backtitle)" --title "CPU Frequency Scaling" \
|
||||
--menu "Choose a Governor\n* Recommended Option" 0 0 0 --file "${TMP_PATH}/opts" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
CPUGOVERNOR=${resp}
|
||||
else
|
||||
[ "${PLATFORM}" = "epyc7002" ] && CPUGOVERNOR="schedutil"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && CPUGOVERNOR="ondemand"
|
||||
fi
|
||||
writeConfigKey "addons.cpufreqscaling" "${CPUGOVERNOR}" "${USER_CONFIG_FILE}"
|
||||
CPUGOVERNOR="$(readConfigKey "addons.cpufreqscaling" "${USER_CONFIG_FILE}")"
|
||||
# Selectable CPU governors
|
||||
[ "${PLATFORM}" = "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && echo -e "conservative \"use conservative to scale frequency *\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/opts"
|
||||
dialog --backtitle "$(backtitle)" --title "CPU Frequency Scaling" \
|
||||
--menu "Choose a Governor\n* Recommended Option" 0 0 0 --file "${TMP_PATH}/opts" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
GOVERNOR=${resp}
|
||||
writeConfigKey "governor" "${GOVERNOR}" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -2367,7 +2313,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"
|
||||
@@ -2376,7 +2322,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
|
||||
@@ -2387,7 +2333,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
|
||||
@@ -2413,7 +2359,7 @@ function genHardwareID() {
|
||||
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "bootscreen.hwidinfo" "true" "${USER_CONFIG_FILE}"
|
||||
dialog --backtitle "$(backtitle)" --title "HardwareID" \
|
||||
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70
|
||||
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!\nMake sure you select Arc Patch while configure." 7 70
|
||||
break
|
||||
else
|
||||
USERID=""
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. "${ARC_PATH}/include/functions.sh"
|
||||
. "${ARC_PATH}/arc-functions.sh"
|
||||
. "${ARC_PATH}/include/addons.sh"
|
||||
. "${ARC_PATH}/include/modules.sh"
|
||||
. "${ARC_PATH}/include/update.sh"
|
||||
. "${ARC_PATH}/include/storage.sh"
|
||||
. "${ARC_PATH}/include/network.sh"
|
||||
. "${ARC_PATH}/include/compat.sh"
|
||||
. "${ARC_PATH}/arc-functions.sh"
|
||||
|
||||
# Get Keymap and Timezone and check System
|
||||
onlineCheck
|
||||
@@ -72,26 +71,14 @@ 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}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Loop menu
|
||||
RESTRICT=1
|
||||
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
|
||||
@@ -114,9 +101,17 @@ function arcModel() {
|
||||
BETA=""
|
||||
[ -n "${ARCCONFM}" ] && ARC="x" || ARC=""
|
||||
[ "${DT}" = "true" ] && DTS="x" || DTS=""
|
||||
IGPU=""
|
||||
IGPUS=""
|
||||
[[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && IGPUS="up to 9th"
|
||||
[ "${A}" = "epyc7002" ] && IGPUS="up to 14th"
|
||||
IGPUID="$(lspci -nd ::300 2>/dev/null | grep "8086" | cut -d' ' -f3 | sed 's/://g')"
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
if [[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && [ "${IGPU}" = "all" ]; then
|
||||
IGPUS="+"
|
||||
elif [ "${A}" = "epyc7002" ] && [[ "${IGPU}" = "epyc7002" || "${IGPU}" = "all" ]]; then
|
||||
IGPUS="x"
|
||||
else
|
||||
IGPUS=""
|
||||
fi
|
||||
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
|
||||
[ "${M}" = "SA6400" ] && HBAS="x"
|
||||
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
|
||||
@@ -125,10 +120,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
|
||||
@@ -150,15 +144,15 @@ function arcModel() {
|
||||
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
|
||||
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\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" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
|
||||
else
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
|
||||
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
|
||||
fi
|
||||
done < <(cat "${TMP_PATH}/modellist")
|
||||
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%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel 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%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
|
||||
[ -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 \
|
||||
@@ -176,7 +170,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
|
||||
;;
|
||||
*)
|
||||
@@ -226,12 +220,12 @@ function arcModel() {
|
||||
###############################################################################
|
||||
# Arc Version Section
|
||||
function arcVersion() {
|
||||
STEP="version"
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
# Get PAT Data from Config
|
||||
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
@@ -239,7 +233,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
|
||||
@@ -256,7 +250,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=""
|
||||
@@ -273,7 +267,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=$?
|
||||
@@ -281,16 +275,18 @@ function arcVersion() {
|
||||
PV=$(cat ${TMP_PATH}/resp)
|
||||
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".url" "${D_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${PV}\".hash" "${D_FILE}")"
|
||||
[ "${PRODUCTVER}" != "${PV:0:3}" ] && PRODUCTVER="${PV:0:3}"
|
||||
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
|
||||
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
|
||||
writeConfigKey "productver" "${PV:0:3}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
VALID="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
|
||||
while true; do
|
||||
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=$?
|
||||
@@ -309,23 +305,22 @@ 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}"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
else
|
||||
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
|
||||
VALID="true"
|
||||
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
|
||||
@@ -363,7 +358,8 @@ function arcVersion() {
|
||||
initConfigKey "addons.sensors" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ "${PLATFORM}" = "apollolake" ] || [ "${PLATFORM}" = "geminilake" ]; then
|
||||
initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${ARC_PATH}/include/i915ids && IGPU="all" || IGPU="epyc7002"; else IGPU=""; fi
|
||||
[ "${IGPU}"="all" ] && initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}" || true
|
||||
fi
|
||||
if echo "${PAT_URL}" 2>/dev/null | grep -q "7.2.2"; then
|
||||
initConfigKey "addons.allowdowngrade" "" "${USER_CONFIG_FILE}"
|
||||
@@ -391,7 +387,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}")"
|
||||
@@ -403,60 +399,61 @@ function arcVersion() {
|
||||
###############################################################################
|
||||
# Arc Patch Section
|
||||
function arcPatch() {
|
||||
STEP="snmac"
|
||||
# Read Model Values
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
# Check for Custom Build
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
|
||||
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
--nocancel --title "SN/Mac Options"\
|
||||
generate_and_write_serial "true"
|
||||
else
|
||||
generate_and_write_serial "false"
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
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)" \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
else
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
--nocancel --title "SN/Mac Options"\
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
dialog --clear --backtitle "$(backtitle)" \
|
||||
--nocancel --title "SN/Mac Options" \
|
||||
--menu "Choose an Option" 7 60 0 \
|
||||
2 "Use random SN/Mac (Reduced DSM Features)" \
|
||||
3 "Use my own SN/Mac (Be sure your Data is valid)" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
fi
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${resp}" ] && return 1
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
SN="$(generateSerial "${MODEL}" "true")"
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
SN="$(generateSerial "${MODEL}" "false")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 3 ]; then
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Serial" \
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
SN="$(cat ${TMP_PATH}/resp)"
|
||||
if [ -z "${SN}" ]; then
|
||||
return
|
||||
else
|
||||
|
||||
case ${resp} in
|
||||
1)
|
||||
generate_and_write_serial "true"
|
||||
;;
|
||||
2)
|
||||
generate_and_write_serial "false"
|
||||
;;
|
||||
3)
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Serial" \
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
SN="$(cat "${TMP_PATH}/resp" | tr '[:lower:]' '[:upper:]')"
|
||||
[ -z "${SN}" ] && return
|
||||
break
|
||||
fi
|
||||
done
|
||||
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
arcSettings
|
||||
}
|
||||
@@ -464,85 +461,70 @@ function arcPatch() {
|
||||
###############################################################################
|
||||
# Arc Settings Section
|
||||
function arcSettings() {
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
# Get Network Config for Loader
|
||||
if [ "${ARCMODE}" = "config" ] || [ "${ARCPATCH}" = "true" ] || [ "${ARCPATCH}" = "false" ]; then
|
||||
STEP="network"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet
|
||||
[ $? -ne 0 ] && return
|
||||
fi
|
||||
|
||||
# Network Config for Loader
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet || return
|
||||
|
||||
if [ "${ONLYPATCH}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ONLYPATCH="false"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 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
|
||||
[ $? -ne 0 ] && return
|
||||
getmapSelection || return
|
||||
fi
|
||||
# Check for Custom Build
|
||||
|
||||
# Select Addons
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Select Addons
|
||||
STEP="addons"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Addons" \
|
||||
--infobox "Loading Addons Table..." 3 40
|
||||
addonSelection
|
||||
[ $? -ne 0 ] && return
|
||||
addonSelection || return
|
||||
fi
|
||||
# Check for CPU Frequency Scaling & Governor
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
|
||||
--infobox "Generating Governor Table..." 3 40
|
||||
governorSelection
|
||||
[ $? -ne 0 ] && return
|
||||
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
[ "${PLATFORM}" = "epyc7002" ] && writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "addons.cpufreqscaling" "conservative" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Check for DT and HBA/Raid Controller
|
||||
if [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
|
||||
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
|
||||
|
||||
# CPU Frequency Scaling & Governor
|
||||
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
|
||||
--infobox "Generating Governor Table..." 3 40
|
||||
governorSelection || return
|
||||
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
writeConfigKey "governor" "schedutil" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
writeConfigKey "governor" "conservative" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
# Check for more then 8 Ethernet Ports
|
||||
fi
|
||||
|
||||
# Warnings and Checks
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${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)"
|
||||
if [ ${DEVICENIC} -gt 8 ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
|
||||
--msgbox "WARN: You have more NIC (${DEVICENIC}) then 8 NIC.\nOnly 8 supported by DSM." 6 60
|
||||
fi
|
||||
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ]; then
|
||||
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
|
||||
fi
|
||||
# Check for AES
|
||||
if [ "${AESSYS}" = "false" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
|
||||
--msgbox "WARN: Your System doesn't support Hardwareencryption in DSM. (AES)" 5 70
|
||||
fi
|
||||
# Check for CPUFREQ
|
||||
if [[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
|
||||
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
|
||||
--msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
|
||||
fi
|
||||
[ ${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
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# eMMC Boot Support
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
if [ "${EMMCBOOT}" = "true" ]; then
|
||||
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
|
||||
@@ -550,33 +532,25 @@ function arcSettings() {
|
||||
deleteConfigKey "modules.mmc_block" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "modules.mmc_core" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
# Final Config Check
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
# Config is done
|
||||
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Ask for Build
|
||||
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" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
arcSummary
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
dialog --clear --no-items --backtitle "$(backtitle)"
|
||||
return
|
||||
fi
|
||||
[ ${resp} -eq 1 ] && arcSummary || dialog --clear --no-items --backtitle "$(backtitle)"
|
||||
else
|
||||
# Build Loader
|
||||
make
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Config failed" \
|
||||
--msgbox "ERROR: Config failed!\nExit." 6 40
|
||||
dialog --backtitle "$(backtitle)" --title "Config failed" --msgbox "ERROR: Config failed!\nExit." 6 40
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -584,7 +558,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}")"
|
||||
@@ -595,19 +568,13 @@ function arcSummary() {
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
if [ "${REMAP}" = "acports" ] || [ "${REMAP}" = "maxports" ]; then
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
elif [ "${REMAP}" = "remap" ]; then
|
||||
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
elif [ "${REMAP}" = "ahci" ]; then
|
||||
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
else
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
|
||||
# Read remap configurations
|
||||
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
|
||||
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
|
||||
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
|
||||
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
|
||||
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
@@ -617,13 +584,14 @@ function arcSummary() {
|
||||
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ]; then
|
||||
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Error" \
|
||||
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check for user-defined remap values
|
||||
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ] && [ -z "${PORTMAP}${DISKMAP}${PORTREMAP}${AHCIPORTREMAP}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Error" \
|
||||
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Print Summary
|
||||
SUMMARY="\Z4> DSM Information\Zn"
|
||||
SUMMARY+="\n>> Model: \Zb${MODEL}\Zn"
|
||||
@@ -648,24 +616,21 @@ function arcSummary() {
|
||||
SUMMARY+="\n>> Addons: \Zb${ADDONSINFO}\Zn"
|
||||
SUMMARY+="\n"
|
||||
SUMMARY+="\n\Z4> Device Information\Zn"
|
||||
SUMMARY+="\n>> AES: \Zb${AESSYS}\Zn"
|
||||
SUMMARY+="\n>> CPU FreqScaling | ACPI: \Zb${CPUFREQ} | ${ACPISYS}\Zn"
|
||||
SUMMARY+="\n>> NIC: \Zb${NIC}\Zn"
|
||||
SUMMARY+="\n>> Total Disks: \Zb${DRIVES}\Zn"
|
||||
SUMMARY+="\n>> Internal Disks: \Zb${HARDDRIVES}\Zn"
|
||||
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
|
||||
SUMMARY+="\n>> Memory: \Zb${RAMTOTAL}GB\Zn"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Config Summary" \
|
||||
SUMMARY+="\n"
|
||||
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Config Summary" \
|
||||
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
|
||||
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0)
|
||||
make
|
||||
;;
|
||||
3)
|
||||
return 0
|
||||
;;
|
||||
255)
|
||||
3|255)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
@@ -674,7 +639,6 @@ function arcSummary() {
|
||||
###############################################################################
|
||||
# Building Loader
|
||||
function make() {
|
||||
STEP="build"
|
||||
# Read Model Config
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
@@ -708,7 +672,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 \
|
||||
@@ -738,28 +702,25 @@ function make() {
|
||||
###############################################################################
|
||||
# Finish Building Loader
|
||||
function arcFinish() {
|
||||
STEP="boot"
|
||||
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ -n "${MODELID}" ]; then
|
||||
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
|
||||
boot
|
||||
else
|
||||
# Ask for Boot
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Build done"\
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Build done" \
|
||||
--no-cancel --menu "Boot now?" 7 40 0 \
|
||||
1 "Yes - Boot DSM now" \
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
boot
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
return
|
||||
fi
|
||||
resp=$(cat "${TMP_PATH}/resp")
|
||||
[ "${resp}" -eq 1 ] && boot || return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -770,6 +731,7 @@ function juniorboot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
@@ -790,6 +752,7 @@ function boot() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Alert" \
|
||||
--yesno "Config changed, you need to rebuild the Loader?" 0 0
|
||||
@@ -807,7 +770,6 @@ function boot() {
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
# Main loop
|
||||
# Check for Arc Mode
|
||||
if [ "${ARCMODE}" = "update" ]; then
|
||||
if [ "${ARCOFFLINE}" != "true" ]; then
|
||||
updateLoader
|
||||
@@ -818,7 +780,6 @@ if [ "${ARCMODE}" = "update" ]; then
|
||||
exec reboot
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ]; then
|
||||
# Check for Custom Build
|
||||
if [ "${BUILDDONE}" = "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
|
||||
arcModel
|
||||
else
|
||||
@@ -878,7 +839,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
if [ "${DT}" = "true" ]; then
|
||||
echo "H \"Hotplug/SortDrives: \Z4${HDDSORT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
else
|
||||
echo "h \"USB Mount: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "h \"USB Mount as Internal: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
fi
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
@@ -908,9 +869,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
|
||||
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
echo "M \"Mount DSM Storage Pool \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "M \"Mount DSM Storage Pool \" " >>"${TMP_PATH}/menu"
|
||||
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
|
||||
echo "s \"Allow Downgrade Version \" " >>"${TMP_PATH}/menu"
|
||||
echo "O \"Official Driver Priority: \Z4${ODP}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
@@ -1047,13 +1006,7 @@ elif [ "${ARCMODE}" = "config" ]; then
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
NEXT="H"
|
||||
;;
|
||||
h) if [ "${USBMOUNT}" = "auto" ]; then
|
||||
USBMOUNT='internal'
|
||||
elif [ "${USBMOUNT}" = "internal" ]; then
|
||||
USBMOUNT='external'
|
||||
elif [ "${USBMOUNT}" = "external" ]; then
|
||||
USBMOUNT='auto'
|
||||
fi
|
||||
h) [ "${USBMOUNT}" = "true" ] && USBMOUNT='false' || USBMOUNT='true'
|
||||
writeConfigKey "usbmount" "${USBMOUNT}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
|
||||
@@ -9,7 +9,6 @@ set -e
|
||||
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
|
||||
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
|
||||
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Get Loader Disk Bus
|
||||
@@ -59,6 +58,27 @@ DSMINFO="$(readConfigKey "bootscreen.dsminfo" "${USER_CONFIG_FILE}")"
|
||||
SYSTEMINFO="$(readConfigKey "bootscreen.systeminfo" "${USER_CONFIG_FILE}")"
|
||||
DISKINFO="$(readConfigKey "bootscreen.diskinfo" "${USER_CONFIG_FILE}")"
|
||||
HWIDINFO="$(readConfigKey "bootscreen.hwidinfo" "${USER_CONFIG_FILE}")"
|
||||
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Build Sanity Check
|
||||
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
|
||||
if [ -z "${MODELID}" ] || [ "${MODELID}" != "${MODEL}" ]; then
|
||||
die "Loader build not completed! Model mismatch!"
|
||||
fi
|
||||
# HardwareID Check
|
||||
if [ "${ARCPATCH}" = "true" ]; then
|
||||
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
|
||||
HWID="$(genHWID)"
|
||||
if [ "${HARDWAREID}" != "${HWID}" ]; then
|
||||
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
|
||||
sleep 5
|
||||
rebootTo "config"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${DSMINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mDSM:\033[0m"
|
||||
@@ -73,6 +93,8 @@ if [ "${SYSTEMINFO}" = "true" ]; then
|
||||
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
|
||||
echo -e "CPU: \033[1;37m${CPU}\033[0m"
|
||||
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
|
||||
echo -e "Governor: \033[1;37m${GOVERNOR}\033[0m"
|
||||
[ "${USBMOUNT}" = "true" ] && echo -e "USB Mount: \033[1;37m${USBMOUNT}\033[0m"
|
||||
echo
|
||||
fi
|
||||
if [ "${DISKINFO}" = "true" ]; then
|
||||
@@ -94,7 +116,12 @@ if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ${HASATA} -eq 0 ] && echo -e "\033[1;31m*** Please insert at least one Sata/SAS/SCSI Disk for System installation, except for the Bootloader Disk. ***\033[0m"
|
||||
[ ${HASATA} -eq 0 ] && echo -e "\033[1;31m*** Note: Please insert at least one Sata/SAS/SCSI Disk for System installation, except the Bootloader Disk. ***\033[0m"
|
||||
fi
|
||||
|
||||
if checkBIOS_VT_d && [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
|
||||
echo -e "\033[1;31m*** Notice: Disable Intel(VT-d)/AMD(AMD-V) in BIOS/UEFI settings if you encounter a boot failure. ***\033[0m"
|
||||
echo
|
||||
fi
|
||||
|
||||
# Read necessary variables
|
||||
@@ -108,28 +135,29 @@ EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
|
||||
MODBLACKLIST="$(readConfigKey "modblacklist" "${USER_CONFIG_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# HardwareID Check
|
||||
if [ "${ARCPATCH}" = "true" ]; then
|
||||
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
|
||||
HWID="$(genHWID)"
|
||||
if [ "${HARDWAREID}" != "${HWID}" ]; then
|
||||
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
|
||||
sleep 5
|
||||
rebootTo "config"
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -A CMDLINE
|
||||
|
||||
# Automated Cmdline
|
||||
CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}"
|
||||
CMDLINE["syno_hw_version"]="${MODELID}"
|
||||
CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check
|
||||
CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check
|
||||
CMDLINE["sn"]="${SN}"
|
||||
|
||||
# NIC Cmdline
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
|
||||
ETHN=$(echo "${ETHX}" | wc -w)
|
||||
ETHM=${ETHM:-${ETHN}}
|
||||
NIC=0
|
||||
for N in ${ETHX}; do
|
||||
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
|
||||
MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')}
|
||||
NIC=$((NIC + 1))
|
||||
CMDLINE["mac${NIC}"]="${MAC}"
|
||||
[ ${NIC} -ge ${ETHM} ] && break
|
||||
done
|
||||
CMDLINE["netif_num"]="${NIC}"
|
||||
|
||||
# Boot Cmdline
|
||||
if grep -q "force_junior" /proc/cmdline; then
|
||||
CMDLINE["force_junior"]=""
|
||||
@@ -152,13 +180,14 @@ if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
|
||||
SIZE=$((${SZ:-0} * ${SS:-0} / 1024 / 1024 + 10))
|
||||
# Read SATADoM type
|
||||
SATADOM="$(readConfigKey "satadom" "${USER_CONFIG_FILE}")"
|
||||
CMDLINE["synoboot_satadom"]="${SATADOM:-2}"
|
||||
CMDLINE["dom_szmax"]="${SIZE}"
|
||||
CMDLINE['synoboot_satadom']="${SATADOM:-2}"
|
||||
CMDLINE['dom_szmax']="${SIZE}"
|
||||
fi
|
||||
CMDLINE['elevator']="elevator"
|
||||
CMDLINE["elevator"]="elevator"
|
||||
else
|
||||
CMDLINE["split_lock_detect"]="off"
|
||||
fi
|
||||
|
||||
if [ "${DT}" = "true" ]; then
|
||||
CMDLINE["syno_ttyS0"]="serial,0x3f8"
|
||||
CMDLINE["syno_ttyS1"]="serial,0x2f8"
|
||||
@@ -167,30 +196,42 @@ else
|
||||
CMDLINE["syno_hdd_detect"]="0"
|
||||
CMDLINE["syno_hdd_powerup_seq"]="0"
|
||||
fi
|
||||
|
||||
CMDLINE["HddHotplug"]="1"
|
||||
CMDLINE["vender_format_version"]="2"
|
||||
CMDLINE["skip_vender_mac_interfaces"]="0,1,2,3,4,5,6,7"
|
||||
CMDLINE["earlyprintk"]=""
|
||||
CMDLINE["earlycon"]="uart8250,io,0x3f8,115200n8"
|
||||
CMDLINE["console"]="ttyS0,115200n8"
|
||||
CMDLINE["consoleblank"]="600"
|
||||
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
|
||||
CMDLINE['earlyprintk']=""
|
||||
CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8"
|
||||
CMDLINE['console']="ttyS0,115200n8"
|
||||
CMDLINE['consoleblank']="600"
|
||||
# CMDLINE['no_console_suspend']="1"
|
||||
CMDLINE["root"]="/dev/md0"
|
||||
CMDLINE["loglevel"]="15"
|
||||
CMDLINE["log_buf_len"]="32M"
|
||||
CMDLINE["rootwait"]=""
|
||||
CMDLINE["panic"]="${KERNELPANIC:-0}"
|
||||
CMDLINE['root']="/dev/md0"
|
||||
CMDLINE['loglevel']="15"
|
||||
CMDLINE['log_buf_len']="32M"
|
||||
CMDLINE['rootwait']=""
|
||||
CMDLINE['panic']="${KERNELPANIC:-0}"
|
||||
# CMDLINE['intremap']="off" # workaround for mlx5_core througput issues from linux mailing list (need more testing)
|
||||
# CMDLINE['amd_iommu_intr']="legacy" # workaround for mlx5_core througput issues from linux mailing list (need more testing)
|
||||
CMDLINE['pcie_aspm']="off"
|
||||
# CMDLINE['intel_pstate']="disable"
|
||||
# CMDLINE['amd_pstate']="disable"
|
||||
# CMDLINE['nomodeset']=""
|
||||
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
|
||||
|
||||
if [ "${USBMOUNT}" = "true" ]; then
|
||||
CMDLINE['usbinternal']=""
|
||||
fi
|
||||
|
||||
if [ -n "${GOVERNOR}" ]; then
|
||||
CMDLINE['governor']="${GOVERNOR}"
|
||||
fi
|
||||
|
||||
# DSM Specific Cmdline
|
||||
CMDLINE["pcie_aspm"]="off"
|
||||
CMDLINE["modprobe.blacklist"]="${MODBLACKLIST}"
|
||||
[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable" || true
|
||||
# [ $(cat /proc/cpuinfo | grep AMD | wc -l) -gt 0 ] && CMDLINE["amd_pstate"]="disable" || true
|
||||
# CMDLINE["nomodeset"]=""
|
||||
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
|
||||
CMDLINE["nox2apic"]=""
|
||||
fi
|
||||
#if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then
|
||||
|
||||
# Disabled for now
|
||||
# if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then
|
||||
# if ! echo "${CMDLINE["modprobe.blacklist"]}" | grep -q "sdhci"; then
|
||||
# [ ! "${CMDLINE["modprobe.blacklist"]}" = "" ] && CMDLINE["modprobe.blacklist"]+=","
|
||||
# CMDLINE["modprobe.blacklist"]+="sdhci,sdhci_pci,sdhci_acpi"
|
||||
@@ -198,33 +239,24 @@ fi
|
||||
# fi
|
||||
if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
|
||||
if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then
|
||||
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE["modprobe.blacklist"]+=","
|
||||
CMDLINE["modprobe.blacklist"]+="mpt3sas"
|
||||
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
|
||||
CMDLINE['modprobe.blacklist']+="mpt3sas"
|
||||
fi
|
||||
#else
|
||||
# CMDLINE['scsi_mod.scan']="sync" # TODO: redpill panic of vmware scsi? (add to cmdline)
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
|
||||
CMDLINE["SASmodel"]="1"
|
||||
fi
|
||||
|
||||
# NIC Cmdline
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
|
||||
ETHN=$(echo ${ETHX} | wc -w)
|
||||
[ -z "${ETHM}" ] && ETHM="${ETHN}"
|
||||
NIC=0
|
||||
for N in ${ETHX}; do
|
||||
MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')" || NIC=$((NIC + 1))
|
||||
[ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}"
|
||||
[ ${NIC} -ge ${ETHM} ] && break
|
||||
done
|
||||
CMDLINE["netif_num"]="${NIC}"
|
||||
|
||||
# Read user network settings
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}"
|
||||
@@ -251,9 +283,6 @@ if [ "${DIRECTBOOT}" = "true" ]; then
|
||||
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
|
||||
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
|
||||
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
|
||||
if ! _bootwait; then
|
||||
exit 0
|
||||
fi
|
||||
echo -e "\033[1;34mReboot with Directboot\033[0m"
|
||||
reboot
|
||||
exit 0
|
||||
@@ -270,14 +299,17 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
fi
|
||||
echo
|
||||
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||
sleep 3
|
||||
sleep 2
|
||||
|
||||
for N in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
while true; do
|
||||
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED @ Mac: ${MAC}\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((COUNT + 1))
|
||||
@@ -285,27 +317,25 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
|
||||
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
|
||||
echo -e "\r${DRIVER} (${MAC}): \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
|
||||
echo -e "\r${DRIVER} (${MAC}): \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
if ! _bootwait; then
|
||||
exit 0
|
||||
fi
|
||||
echo
|
||||
|
||||
DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then
|
||||
@@ -337,7 +367,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
|
||||
KEXECARGS+=" --noefi"
|
||||
fi
|
||||
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} kexecboot" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
echo -e "\033[1;37mBooting DSM...\033[0m"
|
||||
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@ function availableAddons() {
|
||||
local PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
for D in $(find "${ADDONS_PATH}" -maxdepth 1 -type d 2>/dev/null | sort); do
|
||||
[ ! -f "${D}/manifest.yml" ] && continue
|
||||
local ADDON=$(basename ${D})
|
||||
local ADDON=$(basename "${D}")
|
||||
local AVAILABLE="$(readConfigKey "${1}" "${D}/manifest.yml")"
|
||||
[ "${AVAILABLE}" = false ] && continue
|
||||
local SYSTEM=$(readConfigKey "system" "${D}/manifest.yml")
|
||||
@@ -113,3 +113,19 @@ function updateAddon() {
|
||||
rm -f "${F}"
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Read Addon Key
|
||||
# 1 - Addon
|
||||
# 2 - key
|
||||
function readAddonKey() {
|
||||
if [ -z "${1}" ] || [ -z "${2}" ]; then
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
if [ ! -f "${ADDONS_PATH}/${1}/manifest.yml" ]; then
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
readConfigKey "${2}" "${ADDONS_PATH}/${1}/manifest.yml"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
###############################################################################
|
||||
@@ -13,10 +13,11 @@ RAMDISK_PATH="${TMP_PATH}/ramdisk"
|
||||
LOG_FILE="${TMP_PATH}/log.txt"
|
||||
TMP_UP_PATH="${TMP_PATH}/upload"
|
||||
|
||||
USER_GRUB_CONFIG="${PART1_PATH}/boot/grub/grub.cfg"
|
||||
USER_GRUBENVFILE="${PART1_PATH}/boot/grub/grubenv"
|
||||
USER_CONFIG_FILE="${PART1_PATH}/user-config.yml"
|
||||
GRUB_PATH="${PART1_PATH}/boot/grub"
|
||||
USER_GRUB_CONFIG="${GRUB_PATH}/grub.cfg"
|
||||
USER_GRUBENVFILE="${GRUB_PATH}/grubenv"
|
||||
USER_CONFIG_FILE="${PART1_PATH}/user-config.yml"
|
||||
HW_KEY="${PART2_PATH}/machine.key"
|
||||
|
||||
ORI_ZIMAGE_FILE="${PART2_PATH}/zImage"
|
||||
ORI_RDGZ_FILE="${PART2_PATH}/rd.gz"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||
# Copyright (C) 2025 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.
|
||||
|
||||
@@ -68,6 +68,12 @@ function randomhex() {
|
||||
printf "&02X" "$((${RANDOM} % 255 + 1))"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a random digit (0-9A-Z)
|
||||
function genRandomDigit() {
|
||||
echo {0..9} | tr ' ' '\n' | sort -R | head -1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate a random letter
|
||||
function genRandomLetter() {
|
||||
@@ -141,6 +147,14 @@ function generateMacAddress() {
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
function generate_and_write_serial() {
|
||||
local use_patch=$1
|
||||
SN="$(generateSerial "${MODEL}" "${use_patch}")"
|
||||
writeConfigKey "arc.patch" "${use_patch}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Validate a serial number for a model
|
||||
# 1 - Model
|
||||
@@ -375,13 +389,39 @@ function delCmdline() {
|
||||
setCmdline "${1}" "${CMDLINE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# check CPU Intel(VT-d)/AMD(AMD-Vi)
|
||||
function checkCPU_VT_d() {
|
||||
lsmod | grep -q msr || modprobe msr 2>/dev/null
|
||||
if grep -q "GenuineIntel" /proc/cpuinfo 2>/dev/null; then
|
||||
local VT_D_ENABLED=$(rdmsr 0x3a 2>/dev/null)
|
||||
[ "$((${VT_D_ENABLED:-0x0} & 0x5))" -eq $((0x5)) ] && return 0
|
||||
elif grep -q "AuthenticAMD" /proc/cpuinfo 2>/dev/null; then
|
||||
local IOMMU_ENABLED=$(rdmsr 0xC0010114 2>/dev/null)
|
||||
[ "$((${IOMMU_ENABLED:-0x0} & 0x1))" -eq $((0x1)) ] && return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# check BIOS Intel(VT-d)/AMD(AMD-Vi)
|
||||
function checkBIOS_VT_d() {
|
||||
if grep -q "GenuineIntel" /proc/cpuinfo 2>/dev/null; then
|
||||
dmesg 2>/dev/null | grep -iq "DMAR-IR.*DRHD base" && return 0
|
||||
elif grep -q "AuthenticAMD" /proc/cpuinfo 2>/dev/null; then
|
||||
dmesg 2>/dev/null | grep -iq "AMD-Vi.*enabled" && return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Rebooting
|
||||
# (based on pocopico's TCRP code)
|
||||
function rebootTo() {
|
||||
local MODES="config recovery junior automated update bios memtest"
|
||||
[ -z "${1}" ] && exit 1
|
||||
if ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi
|
||||
if ! echo "${MODES}" | grep -wq "${1}"; then exit 1; fi
|
||||
[ "${1}" = "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
|
||||
[ ! -f "${USER_GRUBENVFILE}" ] && grub-editenv ${USER_GRUBENVFILE} create
|
||||
# echo -e "Rebooting to ${1} mode..."
|
||||
@@ -557,7 +597,7 @@ function systemCheck () {
|
||||
fi
|
||||
# Check for CPU Frequency Scaling
|
||||
CPUFREQUENCIES=$(ls -ltr /sys/devices/system/cpu/cpufreq/* 2>/dev/null | wc -l)
|
||||
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" = "true" ]; then
|
||||
if [ ${CPUFREQUENCIES} -gt 1 ]; then
|
||||
CPUFREQ="true"
|
||||
else
|
||||
CPUFREQ="false"
|
||||
@@ -565,6 +605,8 @@ function systemCheck () {
|
||||
# Check for Arc Patch
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
[ -z "${ARCCONF}" ] && writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
# Check for Disks
|
||||
getmap
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -604,11 +646,13 @@ function __umountDSMRootDisk() {
|
||||
###############################################################################
|
||||
# bootwait SSH/Web
|
||||
function _bootwait() {
|
||||
# Exec Bootwait to check SSH/Web connection
|
||||
BOOTWAIT=5
|
||||
BOOTWAIT="$(readConfigKey "bootwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTWAIT}" ] && BOOTWAIT=10
|
||||
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
|
||||
MSG=""
|
||||
while test ${BOOTWAIT} -ge 0; do
|
||||
while [ ${BOOTWAIT} -gt 0 ]; do
|
||||
sleep 1
|
||||
BOOTWAIT=$((BOOTWAIT - 1))
|
||||
MSG="\033[1;33mAccess to SSH/Web will interrupt boot...\033[0m"
|
||||
echo -en "\r${MSG}"
|
||||
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WC
|
||||
@@ -617,8 +661,6 @@ function _bootwait() {
|
||||
rm -f WB WC
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
BOOTWAIT=$((BOOTWAIT - 1))
|
||||
done
|
||||
rm -f WB WC
|
||||
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
|
||||
|
||||
390
files/initrd/opt/arc/include/i915ids
Normal file
390
files/initrd/opt/arc/include/i915ids
Normal file
@@ -0,0 +1,390 @@
|
||||
# INTEL_I810_IDS
|
||||
80867121
|
||||
80867123
|
||||
80867125
|
||||
# INTEL_I815_IDS
|
||||
80861132
|
||||
# INTEL_I830_IDS
|
||||
80863577
|
||||
# INTEL_I845G_IDS
|
||||
80862562
|
||||
# INTEL_I85X_IDS
|
||||
80863582
|
||||
8086358e
|
||||
# INTEL_I865G_IDS
|
||||
80862572
|
||||
# INTEL_I915G_IDS
|
||||
80862582
|
||||
8086258a
|
||||
# INTEL_I915GM_IDS
|
||||
80862592
|
||||
# INTEL_I945G_IDS
|
||||
80862772
|
||||
# INTEL_I945GM_IDS
|
||||
808627a2
|
||||
808627ae
|
||||
# INTEL_I965G_IDS
|
||||
80862972
|
||||
80862982
|
||||
80862992
|
||||
808629a2
|
||||
# INTEL_G33_IDS
|
||||
808629b2
|
||||
808629c2
|
||||
808629d2
|
||||
# INTEL_I965GM_IDS
|
||||
80862a02
|
||||
80862a12
|
||||
# INTEL_GM45_IDS
|
||||
80862a42
|
||||
# INTEL_G45_IDS
|
||||
80862e02
|
||||
80862e12
|
||||
80862e22
|
||||
80862e32
|
||||
80862e42
|
||||
80862e92
|
||||
# INTEL_PINEVIEW_G_IDS
|
||||
8086a001
|
||||
# INTEL_PINEVIEW_M_IDS
|
||||
8086a011
|
||||
# INTEL_IRONLAKE_D_IDS
|
||||
80860042
|
||||
# INTEL_IRONLAKE_M_IDS
|
||||
80860046
|
||||
# INTEL_SNB_D_GT1_IDS
|
||||
80860102
|
||||
8086010A
|
||||
# INTEL_SNB_D_GT2_IDS
|
||||
80860112
|
||||
80860122
|
||||
# INTEL_SNB_M_GT1_IDS
|
||||
80860106
|
||||
# INTEL_SNB_M_GT2_IDS
|
||||
80860116
|
||||
80860126
|
||||
# INTEL_IVB_M_GT1_IDS
|
||||
80860156
|
||||
# INTEL_IVB_M_GT2_IDS
|
||||
80860166
|
||||
# INTEL_IVB_D_GT1_IDS
|
||||
80860152
|
||||
8086015a
|
||||
# INTEL_IVB_D_GT2_IDS
|
||||
80860162
|
||||
8086016a
|
||||
# INTEL_HSW_ULT_GT1_IDS
|
||||
80860A02
|
||||
80860A06
|
||||
80860A0A
|
||||
80860A0B
|
||||
# INTEL_HSW_ULX_GT1_IDS
|
||||
80860A0E
|
||||
# INTEL_HSW_GT1_IDS
|
||||
80860402
|
||||
80860406
|
||||
8086040A
|
||||
8086040B
|
||||
8086040E
|
||||
80860C02
|
||||
80860C06
|
||||
80860C0A
|
||||
80860C0B
|
||||
80860C0E
|
||||
80860D02
|
||||
80860D06
|
||||
80860D0A
|
||||
80860D0B
|
||||
80860D0E
|
||||
# INTEL_HSW_ULT_GT2_IDS
|
||||
80860A12
|
||||
80860A16
|
||||
80860A1A
|
||||
80860A1B
|
||||
# INTEL_HSW_ULX_GT2_IDS
|
||||
80860A1E
|
||||
# INTEL_HSW_GT2_IDS
|
||||
80860412
|
||||
80860416
|
||||
8086041A
|
||||
8086041B
|
||||
8086041E
|
||||
80860C12
|
||||
80860C16
|
||||
80860C1A
|
||||
80860C1B
|
||||
80860C1E
|
||||
80860D12
|
||||
80860D16
|
||||
80860D1A
|
||||
80860D1B
|
||||
80860D1E
|
||||
# INTEL_HSW_ULT_GT3_IDS
|
||||
80860A22
|
||||
80860A26
|
||||
80860A2A
|
||||
80860A2B
|
||||
80860A2E
|
||||
# INTEL_HSW_GT3_IDS
|
||||
80860422
|
||||
80860426
|
||||
8086042A
|
||||
8086042B
|
||||
8086042E
|
||||
80860C22
|
||||
80860C26
|
||||
80860C2A
|
||||
80860C2B
|
||||
80860C2E
|
||||
80860D22
|
||||
80860D26
|
||||
80860D2A
|
||||
80860D2B
|
||||
80860D2E
|
||||
# INTEL_VLV_IDS
|
||||
80860f30
|
||||
80860f31
|
||||
80860f32
|
||||
80860f33
|
||||
# INTEL_BDW_ULT_GT1_IDS
|
||||
80861606
|
||||
8086160B
|
||||
# INTEL_BDW_ULX_GT1_IDS
|
||||
8086160E
|
||||
# INTEL_BDW_GT1_IDS
|
||||
80861602
|
||||
8086160A
|
||||
8086160D
|
||||
# INTEL_BDW_ULT_GT2_IDS
|
||||
80861616
|
||||
8086161B
|
||||
# INTEL_BDW_ULX_GT2_IDS
|
||||
8086161E
|
||||
# INTEL_BDW_GT2_IDS
|
||||
80861612
|
||||
8086161A
|
||||
8086161D
|
||||
# INTEL_BDW_ULT_GT3_IDS
|
||||
80861626
|
||||
8086162B
|
||||
# INTEL_BDW_ULX_GT3_IDS
|
||||
8086162E
|
||||
# INTEL_BDW_GT3_IDS
|
||||
80861622
|
||||
8086162A
|
||||
8086162D
|
||||
# INTEL_BDW_ULT_RSVD_IDS
|
||||
80861636
|
||||
8086163B
|
||||
# INTEL_BDW_ULX_RSVD_IDS
|
||||
8086163E
|
||||
# INTEL_BDW_RSVD_IDS
|
||||
80861632
|
||||
8086163A
|
||||
8086163D
|
||||
# INTEL_CHV_IDS
|
||||
808622b0
|
||||
808622b1
|
||||
808622b2
|
||||
808622b3
|
||||
# INTEL_SKL_ULT_GT1_IDS
|
||||
80861906
|
||||
80861913~
|
||||
# INTEL_SKL_ULX_GT1_IDS
|
||||
8086190E
|
||||
80861915~
|
||||
# INTEL_SKL_GT1_IDS
|
||||
80861902
|
||||
8086190A
|
||||
8086190B
|
||||
80861917~
|
||||
# INTEL_SKL_ULT_GT2_IDS
|
||||
80861916
|
||||
80861921
|
||||
# INTEL_SKL_ULX_GT2_IDS
|
||||
8086191E
|
||||
# INTEL_SKL_GT2_IDS
|
||||
80861912
|
||||
8086191A
|
||||
8086191B
|
||||
8086191D
|
||||
# INTEL_SKL_ULT_GT3_IDS
|
||||
80861923
|
||||
80861926
|
||||
80861927
|
||||
# INTEL_SKL_GT3_IDS
|
||||
8086192A
|
||||
8086192B
|
||||
8086192D
|
||||
# INTEL_SKL_GT4_IDS
|
||||
80861932
|
||||
8086193A
|
||||
8086193B
|
||||
8086193D
|
||||
# INTEL_BXT_IDS
|
||||
80860A84
|
||||
80861A84
|
||||
80861A85
|
||||
80865A84
|
||||
80865A85
|
||||
# INTEL_GLK_IDS
|
||||
80863184
|
||||
80863185
|
||||
# INTEL_KBL_ULT_GT1_IDS
|
||||
80865906
|
||||
80865913
|
||||
# INTEL_KBL_ULX_GT1_IDS
|
||||
8086590E
|
||||
80865915
|
||||
# INTEL_KBL_GT1_IDS
|
||||
80865902
|
||||
80865908
|
||||
8086590A
|
||||
8086590B
|
||||
# INTEL_KBL_ULT_GT2_IDS
|
||||
80865916
|
||||
80865921
|
||||
# INTEL_KBL_ULX_GT2_IDS
|
||||
8086591E
|
||||
# INTEL_KBL_GT2_IDS
|
||||
80865912
|
||||
80865917
|
||||
8086591A
|
||||
8086591B
|
||||
8086591D
|
||||
# INTEL_KBL_ULT_GT3_IDS
|
||||
80865926
|
||||
# INTEL_KBL_GT3_IDS
|
||||
80865923
|
||||
80865927
|
||||
# INTEL_KBL_GT4_IDS
|
||||
8086593B
|
||||
# INTEL_AML_KBL_GT2_IDS
|
||||
8086591C
|
||||
808687C0
|
||||
# INTEL_AML_CFL_GT2_IDS
|
||||
808687CA
|
||||
# INTEL_CML_GT1_IDS
|
||||
80869BA2
|
||||
80869BA4
|
||||
80869BA5
|
||||
80869BA8
|
||||
# INTEL_CML_U_GT1_IDS
|
||||
80869B21
|
||||
80869BAA
|
||||
80869BAC
|
||||
# INTEL_CML_GT2_IDS
|
||||
80869BC2
|
||||
80869BC4
|
||||
80869BC5
|
||||
80869BC6
|
||||
80869BC8
|
||||
80869BE6
|
||||
80869BF6
|
||||
# INTEL_CML_U_GT2_IDS
|
||||
80869B41
|
||||
80869BCA
|
||||
80869BCC
|
||||
# INTEL_CFL_S_GT1_IDS
|
||||
80863E90
|
||||
80863E93
|
||||
80863E99
|
||||
# INTEL_CFL_S_GT2_IDS
|
||||
80863E91
|
||||
80863E92
|
||||
80863E96
|
||||
80863E98
|
||||
80863E9A
|
||||
# INTEL_CFL_H_GT1_IDS
|
||||
80863E9C
|
||||
# INTEL_CFL_H_GT2_IDS
|
||||
80863E94
|
||||
80863E9B
|
||||
# INTEL_CFL_U_GT2_IDS
|
||||
80863EA9
|
||||
# INTEL_CFL_U_GT3_IDS
|
||||
80863EA5
|
||||
80863EA6
|
||||
80863EA7
|
||||
80863EA8
|
||||
# INTEL_WHL_U_GT1_IDS
|
||||
80863EA1
|
||||
80863EA4
|
||||
# INTEL_WHL_U_GT2_IDS
|
||||
80863EA0
|
||||
80863EA3
|
||||
# INTEL_WHL_U_GT3_IDS
|
||||
80863EA2
|
||||
# INTEL_CNL_PORT_F_IDS
|
||||
80865A44
|
||||
80865A4C
|
||||
80865A54
|
||||
80865A5C
|
||||
# INTEL_CNL_IDS
|
||||
80865A40
|
||||
80865A41
|
||||
80865A42
|
||||
80865A49
|
||||
80865A4A
|
||||
80865A50
|
||||
80865A51
|
||||
80865A52
|
||||
80865A59
|
||||
80865A5A
|
||||
# INTEL_ICL_PORT_F_IDS
|
||||
80868A50
|
||||
80868A52
|
||||
80868A53
|
||||
80868A54
|
||||
80868A56
|
||||
80868A57
|
||||
80868A58
|
||||
80868A59
|
||||
80868A5A
|
||||
80868A5B
|
||||
80868A5C
|
||||
80868A70
|
||||
80868A71
|
||||
# INTEL_ICL_11_IDS
|
||||
80868A51
|
||||
80868A5D
|
||||
# INTEL_EHL_IDS
|
||||
80864500~
|
||||
80864541
|
||||
80864551
|
||||
80864555
|
||||
80864557
|
||||
80864570~
|
||||
80864571
|
||||
# INTEL_JSL_IDS
|
||||
80864E51
|
||||
80864E55
|
||||
80864E57
|
||||
80864E61
|
||||
80864E71
|
||||
# INTEL_TGL_12_GT1_IDS
|
||||
80869A60
|
||||
80869A68
|
||||
80869A70
|
||||
# INTEL_TGL_12_GT2_IDS
|
||||
80869A40
|
||||
80869A49
|
||||
80869A59
|
||||
80869A78
|
||||
80869AC0
|
||||
80869AC9
|
||||
80869AD9
|
||||
80869AF8
|
||||
# INTEL_RKL_IDS
|
||||
80864C80
|
||||
80864C8A
|
||||
80864C8B
|
||||
80864C8C
|
||||
80864C90
|
||||
80864C9A
|
||||
# INTEL_DG1_IDS
|
||||
80864905
|
||||
80864906~
|
||||
80864907~
|
||||
80864908~
|
||||
80864909~
|
||||
@@ -7,13 +7,25 @@
|
||||
# eg: N i915.ko
|
||||
|
||||
# kvm
|
||||
N irqbypass.ko
|
||||
N kvm-intel.ko
|
||||
N kvm-amd.ko
|
||||
N kvm.ko
|
||||
F irqbypass.ko
|
||||
F kvm-intel.ko
|
||||
F kvm-amd.ko
|
||||
F kvm.ko
|
||||
|
||||
# acpi
|
||||
N acpi_call.ko
|
||||
N acpi-cpufreq.ko
|
||||
N processor.ko
|
||||
N button.ko
|
||||
|
||||
# cpufreq
|
||||
N cpufreq_governor.ko
|
||||
N cpufreq_ondemand.ko
|
||||
N cpufreq_conservative.ko
|
||||
N cpufreq_performance.ko
|
||||
N cpufreq_powersave.ko
|
||||
N cpufreq_userspace.ko
|
||||
N cpufreq_stats.ko
|
||||
|
||||
# misc
|
||||
N check_signature.ko
|
||||
@@ -34,14 +46,6 @@ N cdc_ether.ko
|
||||
N rndis_host.ko
|
||||
N r8152.ko
|
||||
|
||||
# iwlwifi
|
||||
N libarc4.ko
|
||||
N cfg80211.ko
|
||||
N mac80211.ko
|
||||
N iwlwifi.ko
|
||||
N iwlmvm.ko
|
||||
N iwldvm.ko
|
||||
|
||||
## i915
|
||||
#N dmabuf.ko
|
||||
#N drm.ko
|
||||
|
||||
@@ -49,9 +49,9 @@ function getAllModules() {
|
||||
|
||||
# Get list of all modules
|
||||
for F in $(ls ${TMP_PATH}/modules/*.ko 2>/dev/null); do
|
||||
local X=$(basename ${F})
|
||||
local X=$(basename "${F}")
|
||||
local M=${X:0:-3}
|
||||
local DESC=$(modinfo ${F} | awk -F':' '/description:/{ print $2}' | awk '{sub(/^[ ]+/,""); print}')
|
||||
local DESC=$(modinfo "${F}" | awk -F':' '/description:/{ print $2}' | awk '{sub(/^[ ]+/,""); print}')
|
||||
[ -z "${DESC}" ] && DESC="${X}"
|
||||
echo "${M} \"${DESC}\""
|
||||
done
|
||||
@@ -78,19 +78,19 @@ function installModules() {
|
||||
|
||||
local ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
|
||||
for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do
|
||||
local M=$(basename ${F})
|
||||
local M=$(basename "${F}")
|
||||
[ "${ODP}" = "true" ] && [ -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
|
||||
if echo "${MLIST}" | grep -wq "${M:0:-3}"; then
|
||||
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}"
|
||||
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
|
||||
else
|
||||
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}"
|
||||
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
|
||||
fi
|
||||
done
|
||||
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
|
||||
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
|
||||
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
@@ -118,7 +118,7 @@ function addToModules() {
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
cp -f ${KOFILE} ${TMP_PATH}/modules
|
||||
cp -f "${KOFILE}" "${TMP_PATH}/modules"
|
||||
|
||||
packModules "${PLATFORM}" "${KVER}"
|
||||
}
|
||||
@@ -140,7 +140,7 @@ function delToModules() {
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
rm -f ${TMP_PATH}/modules/${KONAME}
|
||||
rm -f "${TMP_PATH}/modules/${KONAME}"
|
||||
|
||||
packModules "${PLATFORM}" "${KVER}"
|
||||
}
|
||||
@@ -173,7 +173,7 @@ function getdepends() {
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
local DPS=($(_getdepends ${KONAME} | tr ' ' '\n' | sort -u))
|
||||
local DPS=($(_getdepends "${KONAME}" | tr ' ' '\n' | sort -u))
|
||||
echo ${DPS[@]}
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
}
|
||||
@@ -1,34 +1,33 @@
|
||||
# Get Network Config for Loader
|
||||
function getnet() {
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
generate_and_write_macs() {
|
||||
local patch=$1
|
||||
local macs=($(generateMacAddress "${MODEL}" "${ETHN}" "${patch}"))
|
||||
|
||||
for i in $(seq 1 "${ETHN}"); do
|
||||
local mac="${macs[$((i - 1))]}"
|
||||
writeConfigKey "eth$((i - 1))" "${mac}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
MODEL=$(readConfigKey "model" "${USER_CONFIG_FILE}")
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
ETHN=$(echo ${ETHX} | wc -w)
|
||||
if [ "${ARCPATCH}" = "true" ]; then
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
|
||||
for I in $(seq 1 ${ETHN}); do
|
||||
eval MAC${I}="${MACS[$((${I} - 1))]}"
|
||||
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
elif [ "${ARCPATCH}" = "false" ]; then
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
|
||||
for I in $(seq 1 ${ETHN}); do
|
||||
eval MAC${I}="${MACS[$((${I} - 1))]}"
|
||||
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
elif [ "${ARCPATCH}" = "user" ]; then
|
||||
# User Mac
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
ETHN=$(echo "${ETHX}" | wc -w)
|
||||
|
||||
if [ "${ARCPATCH}" = "user" ]; then
|
||||
for N in ${ETHX}; do
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
|
||||
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50\
|
||||
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50 \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
MAC=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
|
||||
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
|
||||
[ -z "${MAC}" ] && MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}")
|
||||
[ -z "${MAC}" ] && MAC=$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')
|
||||
MAC=$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')
|
||||
if [ ${#MAC} -eq 12 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50
|
||||
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
|
||||
@@ -38,13 +37,17 @@ function getnet() {
|
||||
fi
|
||||
done
|
||||
done
|
||||
elif [ "${ARCPATCH}" != "user" ] && [ -n "${ARCCONF}" ]; then
|
||||
generate_and_write_macs "${ARCPATCH}"
|
||||
else
|
||||
generate_and_write_macs "false"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get Amount of NIC
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
|
||||
# Get actual IP
|
||||
for N in ${ETHX}; do
|
||||
IPCON="$(getIP "${N}")"
|
||||
[ -n "${IPCON}" ] && break
|
||||
[ -n "${IPCON}" ] && break || IPCON="noip"
|
||||
done
|
||||
@@ -1,109 +1,133 @@
|
||||
# Get PortMap for Loader
|
||||
function getmap() {
|
||||
function show_and_set_remap() {
|
||||
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
|
||||
|
||||
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
|
||||
# Clean old files
|
||||
[ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax" && touch "${TMP_PATH}/drivesmax" || true
|
||||
[ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon" && touch "${TMP_PATH}/drivescon" || true
|
||||
[ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports" && touch "${TMP_PATH}/ports" || true
|
||||
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" && touch "${TMP_PATH}/remap" || true
|
||||
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
|
||||
let DISKIDXMAPIDX=0
|
||||
DISKIDXMAP=""
|
||||
let DISKIDXMAPIDXMAX=0
|
||||
DISKIDXMAPMAX=""
|
||||
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
|
||||
NUMPORTS=0
|
||||
CONPORTS=0
|
||||
unset HOSTPORTS
|
||||
declare -A HOSTPORTS
|
||||
while read -r LINE; do
|
||||
ATAPORT="$(echo ${LINE} | grep -o 'ata[0-9]*')"
|
||||
PORT=$(echo ${ATAPORT} | sed 's/ata//')
|
||||
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
|
||||
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
|
||||
while read -r PORT; do
|
||||
ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0
|
||||
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
|
||||
[ ${PCMD} = 0 ] && DUMMY=1 || DUMMY=0
|
||||
[ ${ATTACH} = 1 ] && CONPORTS="$((${CONPORTS} + 1))" && echo "$((${PORT} - 1))" >>"${TMP_PATH}/ports"
|
||||
[ ${DUMMY} = 1 ] # Do nothing for now
|
||||
NUMPORTS=$((${NUMPORTS} + 1))
|
||||
done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
|
||||
[ ${NUMPORTS} -gt 8 ] && NUMPORTS=8
|
||||
[ ${CONPORTS} -gt 8 ] && CONPORTS=8
|
||||
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
|
||||
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
|
||||
DISKIDXMAP=$DISKIDXMAP$(printf "%02x" $DISKIDXMAPIDX)
|
||||
let DISKIDXMAPIDX=$DISKIDXMAPIDX+$CONPORTS
|
||||
DISKIDXMAPMAX=$DISKIDXMAPMAX$(printf "%02x" $DISKIDXMAPIDXMAX)
|
||||
let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS
|
||||
SATADRIVES=$((${SATADRIVES} + ${CONPORTS}))
|
||||
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
|
||||
fi
|
||||
|
||||
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)
|
||||
DISKIDXMAPIDX=$((DISKIDXMAPIDX + CONPORTS))
|
||||
DISKIDXMAPMAX+=$(printf "%02x" $DISKIDXMAPIDXMAX)
|
||||
DISKIDXMAPIDXMAX=$((DISKIDXMAPIDXMAX + NUMPORTS))
|
||||
SATADRIVES=$((SATADRIVES + CONPORTS))
|
||||
done
|
||||
fi
|
||||
|
||||
# SAS Disks
|
||||
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
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
|
||||
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}))
|
||||
SASDRIVES=$((SASDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# SCSI Disks
|
||||
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
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort - 2>/dev/null)
|
||||
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}))
|
||||
SCSIDRIVES=$((SCSIDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# Raid Disks
|
||||
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
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
|
||||
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}))
|
||||
RAIDDRIVES=$((RAIDDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# NVMe Disks
|
||||
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
|
||||
if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
|
||||
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)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
USBDRIVES=$((${USBDRIVES} + ${PORTNUM}))
|
||||
USBDRIVES=$((USBDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# MMC Disks
|
||||
MMCDRIVES=0
|
||||
if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::805 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
# NVMe Disks
|
||||
NVMEDRIVES=0
|
||||
if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n 2>/dev/null)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l)
|
||||
NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM}))
|
||||
MMCDRIVES=$((MMCDRIVES + PORTNUM))
|
||||
done
|
||||
fi
|
||||
|
||||
# Disk Count for MaxDisks
|
||||
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
|
||||
HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
|
||||
@@ -116,30 +140,32 @@ function getmap() {
|
||||
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Check for Sata Boot
|
||||
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
|
||||
LASTDRIVE=0
|
||||
while read -r D; do
|
||||
if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
|
||||
MAXDISKS=${DRIVES}
|
||||
echo -n "${D}>${MAXDISKS}:">>"${TMP_PATH}/remap"
|
||||
elif [ ${D} != ${LASTDRIVE} ]; then
|
||||
echo -n "${D}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
|
||||
LASTDRIVE=$((${LASTDRIVE} + 1))
|
||||
elif [ ${D} = ${LASTDRIVE} ]; then
|
||||
LASTDRIVE=$((${D} + 1))
|
||||
echo -n "${D}>${MAXDISKS}:" >>"${TMP_PATH}/remap"
|
||||
elif [ ${D} -ne ${LASTDRIVE} ]; then
|
||||
echo -n "${D}>${LASTDRIVE}:" >>"${TMP_PATH}/remap"
|
||||
LASTDRIVE=$((LASTDRIVE + 1))
|
||||
else
|
||||
LASTDRIVE=$((D + 1))
|
||||
fi
|
||||
done < <(cat "${TMP_PATH}/ports")
|
||||
done < "${TMP_PATH}/ports"
|
||||
fi
|
||||
}
|
||||
|
||||
function getmapSelection() {
|
||||
# Compute PortMap Options
|
||||
SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")"
|
||||
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
|
||||
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
|
||||
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax")
|
||||
SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon")
|
||||
SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')
|
||||
EXTERNALCONTROLLER=$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")
|
||||
ARCMODE=$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")
|
||||
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
# Show recommended Option to user
|
||||
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
@@ -149,43 +175,7 @@ function getmapSelection() {
|
||||
else
|
||||
REMAP1="*"
|
||||
fi
|
||||
# Ask for Portmap
|
||||
if [ "${STEP}" = "storagemap" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --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
|
||||
else
|
||||
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
|
||||
fi
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 3 ]; then
|
||||
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 4 ]; then
|
||||
writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 5 ]; then
|
||||
writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
show_and_set_remap
|
||||
else
|
||||
# Show recommended Option to user
|
||||
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
|
||||
@@ -198,55 +188,46 @@ function getmapSelection() {
|
||||
fi
|
||||
# Check Remap for correct config
|
||||
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
|
||||
# Write Map to config and show Map to User
|
||||
if [ "${REMAP}" = "acports" ]; then
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
elif [ "${REMAP}" = "maxports" ]; then
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
elif [ "${REMAP}" = "remap" ]; then
|
||||
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
elif [ "${REMAP}" = "ahci" ]; then
|
||||
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
elif [ "${REMAP}" = "user" ]; then
|
||||
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
|
||||
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
|
||||
|
||||
case "${REMAP}" in
|
||||
"acports")
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"maxports")
|
||||
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"remap")
|
||||
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
"ahci")
|
||||
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
|
||||
;;
|
||||
esac
|
||||
return
|
||||
}
|
||||
|
||||
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
|
||||
SATACONTROLLER=$(lspci -d ::106 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}"
|
||||
if [ ${SATACONTROLLER} -gt 0 ]; then
|
||||
writeConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
SASCONTROLLER=$(lspci -d ::107 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}"
|
||||
if [ ${SASCONTROLLER} -gt 0 ]; then
|
||||
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
SCSICONTROLLER=$(lspci -d ::100 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}"
|
||||
if [ ${SCSICONTROLLER} -gt 0 ]; then
|
||||
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
RAIDCONTROLLER=$(lspci -d ::104 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.raidcontroller" "${RAIDCONTROLLER}" "${USER_CONFIG_FILE}"
|
||||
if [ ${RAIDCONTROLLER} -gt 0 ]; then
|
||||
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Check Controller for Disks
|
||||
getmap
|
||||
declare -A controllers=(
|
||||
[satacontroller]=106
|
||||
[sascontroller]=107
|
||||
[scsicontroller]=100
|
||||
[raidcontroller]=104
|
||||
)
|
||||
|
||||
external_controller=false
|
||||
|
||||
for controller in "${!controllers[@]}"; do
|
||||
count=$(lspci -d ::${controllers[$controller]} 2>/dev/null | wc -l)
|
||||
writeConfigKey "device.${controller}" "${count}" "${USER_CONFIG_FILE}"
|
||||
if [ "${controller}" != "satacontroller" ] && [ ${count} -gt 0 ]; then
|
||||
external_controller=true
|
||||
fi
|
||||
done
|
||||
|
||||
writeConfigKey "device.externalcontroller" "${external_controller}" "${USER_CONFIG_FILE}"
|
||||
@@ -457,9 +457,14 @@ function updateLKMs() {
|
||||
function updateOffline() {
|
||||
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCOFFLINE}" != "true" ]; then
|
||||
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak"
|
||||
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak" || true
|
||||
curl -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/refs/heads/main/data.yml" -o "${MODEL_CONFIG_PATH}/data.yml"
|
||||
[ ! -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
|
||||
|
||||
# Check file size and restore backup if necessary
|
||||
local FILESIZE=$(stat -c%s "${MODEL_CONFIG_PATH}/data.yml")
|
||||
if [ "${FILESIZE}" -lt 3072 ]; then
|
||||
cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@@ -467,34 +472,24 @@ function updateOffline() {
|
||||
###############################################################################
|
||||
# Loading Update Mode
|
||||
function dependenciesUpdate() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
FAILED="false"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Updating Dependencies..." 3 40
|
||||
sleep 2
|
||||
updateAddons
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateModules
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateCustom
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updatePatches
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateLKMs
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateOffline
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
|
||||
FAILED="false"
|
||||
for updateFunction in updateAddons updateModules updateCustom updatePatches updateLKMs updateOffline; do
|
||||
$updateFunction || FAILED="true"
|
||||
done
|
||||
|
||||
if [ "${FAILED}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update Dependencies failed! Try again later." 3 40
|
||||
sleep 3
|
||||
elif [ "${FAILED}" = "false" ]; then
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update Dependencies successful!" 3 40
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 3
|
||||
clear
|
||||
exec arc.sh
|
||||
fi
|
||||
sleep 3
|
||||
clear
|
||||
exec arc.sh
|
||||
}
|
||||
@@ -55,6 +55,7 @@ initConfigKey "bootipwait" "30" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "directboot" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "governor" "performance" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "kernelload" "power" "${USER_CONFIG_FILE}"
|
||||
@@ -81,7 +82,7 @@ initConfigKey "rd-compressed" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "satadom" "2" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "time" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "usbmount" "auto" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "usbmount" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
if grep -q "automated_arc" /proc/cmdline; then
|
||||
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
|
||||
@@ -134,8 +135,8 @@ PID="0x0001"
|
||||
|
||||
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen"
|
||||
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)"
|
||||
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)"
|
||||
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
|
||||
die "$(printf "The boot disk does not support the current %s, only %s are supported." "${BUS}" "${BUSLIST// /\/}")"
|
||||
fi
|
||||
|
||||
@@ -43,46 +43,50 @@ ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
|
||||
[ "${PATURL:0:1}" = "#" ] && PATURL=""
|
||||
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
|
||||
|
||||
# Check if DSM Version changed
|
||||
. "${RAMDISK_PATH}/etc/VERSION"
|
||||
|
||||
if [[ -n "${PRODUCTVER}" && -n "${BUILDNUM}" && -n "${SMALLNUM}" ]] &&
|
||||
([ "${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}"))"
|
||||
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 "\nVersion changed from ${OLDVER} to ${NEWVER}"
|
||||
fi
|
||||
PRODUCTVER=${majorversion}.${minorversion}
|
||||
BUILDNUM=${buildnumber}
|
||||
SMALLNUM=${smallfixnumber}
|
||||
|
||||
# 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
|
||||
|
||||
PRODUCTVER="${majorversion}.${minorversion}"
|
||||
BUILDNUM="${buildnumber}"
|
||||
SMALLNUM="${smallfixnumber}"
|
||||
|
||||
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "buildnum" "${BUILDNUM}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
|
||||
|
||||
# Read model data
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
|
||||
# Modify KVER for Epyc7002
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
|
||||
# Sanity check
|
||||
if [ -z "${PLATFORM}" ] || [ -z "${KVER}" ]; then
|
||||
echo "ERROR: Configuration for model ${MODEL} and productversion ${PRODUCTVER} not found." >"${LOG_FILE}"
|
||||
echo "ERROR: Configuration for Model ${MODEL} and Version ${PRODUCTVER} not found." >"${LOG_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -A SYNOINFO
|
||||
declare -A ADDONS
|
||||
declare -A MODULES
|
||||
|
||||
# Read synoinfo and addons from config
|
||||
declare -A SYNOINFO ADDONS MODULES
|
||||
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
|
||||
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
@@ -93,35 +97,24 @@ while IFS=': ' read -r KEY VALUE; do
|
||||
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
|
||||
PATCHS=(
|
||||
PATCHES=(
|
||||
"ramdisk-etc-rc-*.patch"
|
||||
"ramdisk-init-script-*.patch"
|
||||
"ramdisk-post-init-script-*.patch"
|
||||
"ramdisk-disable-root-pwd-*.patch"
|
||||
"ramdisk-disable-disabled-ports-*.patch"
|
||||
)
|
||||
for PE in "${PATCHS[@]}"; do
|
||||
RET=1
|
||||
echo "Patching with ${PE}" >"${LOG_FILE}"
|
||||
# ${PE} contains *, so double quotes cannot be added
|
||||
for PF in $(ls ${PATCH_PATH}/${PE} 2>/dev/null); do
|
||||
echo "Patching with ${PF}" >>"${LOG_FILE}"
|
||||
# busybox patch and gun patch have different processing methods and parameters.
|
||||
(cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1
|
||||
RET=$?
|
||||
[ ${RET} -eq 0 ] && break
|
||||
done
|
||||
[ ${RET} -ne 0 ] && exit 1
|
||||
done
|
||||
|
||||
# Add serial number to synoinfo.conf, to help to recovery a 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
|
||||
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
|
||||
for PATCH in "${PATCHES[@]}"; do
|
||||
echo "Patching with ${PATCH}" >>"${LOG_FILE}"
|
||||
for PF in ${PATCH_PATH}/${PATCH}; do
|
||||
[ -e "${PF}" ] || continue
|
||||
echo "Applying patch ${PF}" >>"${LOG_FILE}"
|
||||
if ! (cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1; then
|
||||
echo "Failed to apply patch ${FILE}" >>"${LOG_FILE}"
|
||||
continue
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Patch /sbin/init.post
|
||||
@@ -163,7 +156,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo "export PLATFORM=\"${PLATFORM}\""
|
||||
echo "export MODEL=\"${MODEL}\""
|
||||
echo "export MODELID=\"${MODELID}\""
|
||||
echo "export PRODUCTVER=\"${PRODUCTVER}\""
|
||||
echo "export PRODUCTVERL=\"${PRODUCTVERL}\""
|
||||
echo "export MLINK=\"${PAT_URL}\""
|
||||
echo "export MCHECKSUM=\"${PAT_HASH}\""
|
||||
echo "export LAYOUT=\"${LAYOUT:-qwerty}\""
|
||||
@@ -172,12 +165,11 @@ mkdir -p "${RAMDISK_PATH}/addons"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# System Addons
|
||||
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol" "mountloader"; do
|
||||
for ADDON in redpill revert misc eudev disks localrss notify wol mountloader; do
|
||||
PARAMS=""
|
||||
if [ "${ADDON}" = "disks" ]; then
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
|
||||
PARAMS="${HDDSORT} ${USBMOUNT}"
|
||||
PARAMS="${HDDSORT}"
|
||||
[ -f "${USER_UP_PATH}/${MODEL}.dts" ] && cp -f "${USER_UP_PATH}/${MODEL}.dts" "${RAMDISK_PATH}/addons/model.dts"
|
||||
fi
|
||||
installAddon "${ADDON}" "${PLATFORM}" || exit 1
|
||||
@@ -185,8 +177,8 @@ for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol"
|
||||
done
|
||||
|
||||
# User Addons
|
||||
for ADDON in ${!ADDONS[@]}; do
|
||||
PARAMS=${ADDONS[${ADDON}]}
|
||||
for ADDON in "${!ADDONS[@]}"; do
|
||||
PARAMS="${ADDONS[${ADDON}]}"
|
||||
installAddon "${ADDON}" "${PLATFORM}" || echo "Addon ${ADDON} not found"
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
done
|
||||
@@ -196,7 +188,7 @@ echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
echo "Modify files" >"${LOG_FILE}"
|
||||
# Remove function from scripts
|
||||
[ "2" = "${PRODUCTVER:0:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
|
||||
[ "2" = "${PRODUCTVER:2:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
|
||||
|
||||
# Build modules dependencies
|
||||
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
|
||||
@@ -211,7 +203,7 @@ fi
|
||||
# backup current loader configs
|
||||
BACKUP_PATH="${RAMDISK_PATH}/usr/arc/backup"
|
||||
rm -rf "${BACKUP_PATH}"
|
||||
for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}"; do
|
||||
for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}" "${HW_KEY}"; do
|
||||
if [ -f "${F}" ]; then
|
||||
FD="$(dirname "${F}")"
|
||||
mkdir -p "${FD/\/mnt/${BACKUP_PATH}}"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
23.1.1
|
||||
@@ -1,46 +1,66 @@
|
||||
set default="boot"
|
||||
|
||||
set timeout="5"
|
||||
set timeout_style="menu"
|
||||
set vesa_mode=1
|
||||
set menu_color_normal=white/black
|
||||
set menu_color_highlight=white/red
|
||||
set color_normal=white/black
|
||||
|
||||
if [ -s ${prefix}/grubenv ]; then
|
||||
load_env --skip-sig
|
||||
fi
|
||||
|
||||
if [ "${next_entry}" ]; then
|
||||
set default="${next_entry}"
|
||||
unset next_entry
|
||||
save_env next_entry
|
||||
fi
|
||||
if [ "${vesa_mode}" ]; then
|
||||
set vesa_mode=${vesa_mode}
|
||||
fi
|
||||
|
||||
terminal_input console
|
||||
terminal_output console
|
||||
|
||||
if [ "${feature_all_video_module}" = "y" ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
insmod vbe
|
||||
insmod vga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
set default="boot"
|
||||
fi
|
||||
|
||||
if loadfont unicode; then
|
||||
insmod gfxterm
|
||||
if [ "${linux_gfx_mode}" ]; then
|
||||
save_env linux_gfx_mode
|
||||
else
|
||||
set linux_gfx_mode=keep
|
||||
save_env linux_gfx_mode
|
||||
fi
|
||||
|
||||
if [ x"${feature_menuentry_id}" = xy ]; then
|
||||
menuentry_id_option="--id"
|
||||
else
|
||||
menuentry_id_option=""
|
||||
fi
|
||||
|
||||
export menuentry_id_option
|
||||
|
||||
function load_video {
|
||||
if [ x"${feature_all_video_module}" = xy ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
insmod ieee1275_fb
|
||||
insmod vbe
|
||||
insmod vga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
fi
|
||||
}
|
||||
|
||||
set menu_color_normal=white/black
|
||||
set menu_color_highlight=white/red
|
||||
set color_normal=white/black
|
||||
|
||||
if [ x"${feature_default_font_path}" = xy ]; then
|
||||
font=unicode
|
||||
else
|
||||
font=${prefix}/fonts/unicode.pf2
|
||||
fi
|
||||
|
||||
if loadfont ${font}; then
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
set gfxmode=auto
|
||||
terminal_output --append gfxterm
|
||||
else
|
||||
set gfxmode=1024x768
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
load_video
|
||||
insmod gfxterm
|
||||
insmod gfxmenu
|
||||
loadfont ${prefix}/theme/dejavu_bold_14.pf2
|
||||
loadfont ${prefix}/theme/dejavu_mono_12.pf2
|
||||
@@ -49,27 +69,30 @@ if loadfont unicode; then
|
||||
export theme
|
||||
fi
|
||||
|
||||
terminal_output gfxterm
|
||||
|
||||
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
|
||||
terminal_input --append serial
|
||||
terminal_output --append serial
|
||||
fi
|
||||
|
||||
function set_gfxpayload {
|
||||
if [ ${vesa_mode} -eq 1 ]; then
|
||||
set gfxpayload=keep
|
||||
else
|
||||
set gfxpayload=text
|
||||
fi
|
||||
function gfxmode {
|
||||
set gfxpayload="${linux_gfx_mode}"
|
||||
if [ "${linux_gfx_mode}" = "keep" ]; then
|
||||
set vt_handoff=vt.handoff=7
|
||||
else
|
||||
set vt_handoff=
|
||||
fi
|
||||
}
|
||||
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable nox2apic nomodeset"
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off amd_iommu_intr=legacy net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable amd_pstate=disable nox2apic nomodeset"
|
||||
|
||||
search --set=root --label "ARC3"
|
||||
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
if [ "${default}" = "direct" ]; then
|
||||
set timeout="1"
|
||||
menuentry 'DSM Direct Mode' --id direct {
|
||||
set_gfxpayload
|
||||
menuentry 'DSM Direct Mode' ${menuentry_id_option} direct {
|
||||
gfxmode
|
||||
echo "Loading DSM Kernel..."
|
||||
linux /zImage-dsm ${dsm_cmdline}
|
||||
echo "Loading DSM Initramfs..."
|
||||
@@ -78,8 +101,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
echo "Access http://find.synology.com/ to connect the DSM via web."
|
||||
}
|
||||
fi
|
||||
menuentry 'Arc DSM Mode' --id boot {
|
||||
set_gfxpayload
|
||||
menuentry 'Arc DSM Mode' ${menuentry_id_option} boot {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline}
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -93,8 +116,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
fi
|
||||
|
||||
if [ -e /automated ]; then
|
||||
menuentry 'Arc Automated Mode' --id automated {
|
||||
set_gfxpayload
|
||||
menuentry 'Arc Automated Mode' ${menuentry_id_option} automated {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -107,8 +130,8 @@ if [ -e /automated ]; then
|
||||
}
|
||||
fi
|
||||
|
||||
menuentry 'Arc Config Mode' --id config {
|
||||
set_gfxpayload
|
||||
menuentry 'Arc Config Mode' ${menuentry_id_option} config {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -121,8 +144,8 @@ menuentry 'Arc Config Mode' --id config {
|
||||
}
|
||||
|
||||
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
menuentry 'Arc Update Mode' --id update {
|
||||
set_gfxpayload
|
||||
menuentry 'Arc Update Mode' ${menuentry_id_option} update {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} update_arc
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -133,8 +156,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
fi
|
||||
echo "Booting..."
|
||||
}
|
||||
menuentry 'DSM Recovery Mode' --id recovery {
|
||||
set_gfxpayload
|
||||
menuentry 'DSM Recovery Mode' ${menuentry_id_option} recovery {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} recovery
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -145,8 +168,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
fi
|
||||
echo "Booting..."
|
||||
}
|
||||
menuentry 'DSM Reinstall Mode' --id junior {
|
||||
set_gfxpayload
|
||||
menuentry 'DSM Reinstall Mode' ${menuentry_id_option} junior {
|
||||
gfxmode
|
||||
echo "Loading Arc Kernel..."
|
||||
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_junior
|
||||
echo "Loading Arc Initramfs..."
|
||||
@@ -159,31 +182,30 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
}
|
||||
fi
|
||||
|
||||
menuentry 'Enter BIOS Setup' --id bios {
|
||||
menuentry 'System UEFI Setup' ${menuentry_id_option} uefi {
|
||||
fwsetup
|
||||
}
|
||||
|
||||
menuentry 'Start Memtest86+' --id memtest {
|
||||
menuentry 'System Memtest86+' ${menuentry_id_option} memtest {
|
||||
echo "Loading memtest86+..."
|
||||
linux ${prefix}/memtest
|
||||
}
|
||||
|
||||
menuentry 'Poweroff' --id poweroff {
|
||||
menuentry 'System Poweroff' ${menuentry_id_option} poweroff {
|
||||
echo "System is powering off..."
|
||||
halt
|
||||
}
|
||||
|
||||
if [ ${vesa_mode} = 1 ]; then
|
||||
menuentry 'Change Vesa to Text Output' --id videomode {
|
||||
set vesa_mode=0
|
||||
save_env vesa_mode
|
||||
if [ "${linux_gfx_mode}" = "keep" ]; then
|
||||
menuentry 'Change vesa to text video mode' ${menuentry_id_option} videomode {
|
||||
set linux_gfx_mode=text
|
||||
save_env linux_gfx_mode
|
||||
configfile ${prefix}/grub.cfg
|
||||
}
|
||||
else
|
||||
menuentry 'Change Text to Vesa Output' --id videomode {
|
||||
set vesa_mode=1
|
||||
save_env vesa_mode
|
||||
reboot
|
||||
menuentry 'Change text to vesa video mode' ${menuentry_id_option} videomode {
|
||||
set linux_gfx_mode=keep
|
||||
save_env linux_gfx_mode
|
||||
configfile ${prefix}/grub.cfg
|
||||
}
|
||||
fi
|
||||
72
img-gen-n.sh
72
img-gen-n.sh
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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.img"
|
||||
gzip -dc "files/initrd/opt/arc/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="next"
|
||||
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"
|
||||
createArc
|
||||
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}
|
||||
|
||||
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
|
||||
@@ -1,4 +1,10 @@
|
||||
#!/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
|
||||
|
||||
@@ -21,7 +27,10 @@ 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
|
||||
evo) getBuildroot "${1}" "br" ;;
|
||||
*) echo "Invalid option specified" ;;
|
||||
esac
|
||||
|
||||
# Sbase
|
||||
IMAGE_FILE="arc.img"
|
||||
@@ -39,18 +48,17 @@ 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="stable"
|
||||
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
|
||||
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
|
||||
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
|
||||
ARC_BRANCH="dev"
|
||||
echo "${ARC_VERSION}" >"files/p1/ARC-VERSION"
|
||||
echo "${ARC_BUILD}" >"files/p1/ARC-BUILD"
|
||||
echo "${ARC_BRANCH}" >"files/p1/ARC-BRANCH"
|
||||
|
||||
echo "Repack initrd"
|
||||
if [ -f "brs/bzImage-arc" ] && [ -f "brs/initrd-arc" ]; then
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
createArc
|
||||
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
|
||||
105
scripts/func.sh
105
scripts/func.sh
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
|
||||
#
|
||||
# This is free software, licensed under the MIT License.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
@@ -185,50 +185,33 @@ 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=""
|
||||
local REPO="arc-buildroot-${TYPE}"
|
||||
|
||||
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}"
|
||||
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 BRTAG="${TAG}-${TYPE}"
|
||||
[ ! -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: ${TAG}-${TYPE}"
|
||||
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)"')
|
||||
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
|
||||
@@ -294,36 +277,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
|
||||
@@ -500,11 +493,3 @@ function copyBuildroot() {
|
||||
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
}
|
||||
|
||||
# create arc executable
|
||||
function createArc() {
|
||||
./scripts/make/makeself.sh --current --zstd --quiet "../arc/files/initrd/opt/arc" arc "Arc Loader" "./init.sh"
|
||||
rm -rf "../arc/files/initrd/opt/arc"
|
||||
mkdir -p "../arc/files/initrd/opt/arc"
|
||||
mv -f "arc" "../arc/files/initrd/opt/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
|
||||
|
||||
@@ -1,714 +0,0 @@
|
||||
cat << EOF > "$archname"
|
||||
#!/bin/sh
|
||||
# This script was generated using Makeself $MS_VERSION
|
||||
# The license covering this archive and its contents, if any, is wholly independent of the Makeself license (GPL)
|
||||
|
||||
ORIG_UMASK=\`umask\`
|
||||
if test "$KEEP_UMASK" = n; then
|
||||
umask 077
|
||||
fi
|
||||
|
||||
CRCsum="$CRCsum"
|
||||
MD5="$MD5sum"
|
||||
SHA="$SHAsum"
|
||||
SIGNATURE="$Signature"
|
||||
TMPROOT=\${TMPDIR:=/tmp}
|
||||
USER_PWD="\$PWD"
|
||||
export USER_PWD
|
||||
ARCHIVE_DIR=\`dirname "\$0"\`
|
||||
export ARCHIVE_DIR
|
||||
|
||||
label="$LABEL"
|
||||
script="$SCRIPT"
|
||||
scriptargs="$SCRIPTARGS"
|
||||
cleanup_script="${CLEANUP_SCRIPT}"
|
||||
licensetxt="$LICENSE"
|
||||
helpheader="${HELPHEADER}"
|
||||
targetdir="$archdirname"
|
||||
filesizes="$filesizes"
|
||||
totalsize="$totalsize"
|
||||
keep="$KEEP"
|
||||
nooverwrite="$NOOVERWRITE"
|
||||
quiet="n"
|
||||
accept="n"
|
||||
nodiskspace="n"
|
||||
export_conf="$EXPORT_CONF"
|
||||
decrypt_cmd="$DECRYPT_CMD"
|
||||
skip="$SKIP"
|
||||
|
||||
print_cmd_arg=""
|
||||
if type printf > /dev/null; then
|
||||
print_cmd="printf"
|
||||
elif test -x /usr/ucb/echo; then
|
||||
print_cmd="/usr/ucb/echo"
|
||||
else
|
||||
print_cmd="echo"
|
||||
fi
|
||||
|
||||
if test -d /usr/xpg4/bin; then
|
||||
PATH=/usr/xpg4/bin:\$PATH
|
||||
export PATH
|
||||
fi
|
||||
|
||||
if test -d /usr/sfw/bin; then
|
||||
PATH=\$PATH:/usr/sfw/bin
|
||||
export PATH
|
||||
fi
|
||||
|
||||
unset CDPATH
|
||||
|
||||
MS_Printf()
|
||||
{
|
||||
\$print_cmd \$print_cmd_arg "\$1"
|
||||
}
|
||||
|
||||
MS_PrintLicense()
|
||||
{
|
||||
PAGER=\${PAGER:=more}
|
||||
if test x"\$licensetxt" != x; then
|
||||
PAGER_PATH=\`exec <&- 2>&-; which \$PAGER || command -v \$PAGER || type \$PAGER\`
|
||||
if test -x "\$PAGER_PATH"; then
|
||||
echo "\$licensetxt" | \$PAGER
|
||||
else
|
||||
echo "\$licensetxt"
|
||||
fi
|
||||
if test x"\$accept" != xy; then
|
||||
while true
|
||||
do
|
||||
MS_Printf "Please type y to accept, n otherwise: "
|
||||
read yn
|
||||
if test x"\$yn" = xn; then
|
||||
keep=n
|
||||
eval \$finish; exit 1
|
||||
break;
|
||||
elif test x"\$yn" = xy; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
MS_diskspace()
|
||||
{
|
||||
(
|
||||
df -k "\$1" | tail -1 | awk '{ if (\$4 ~ /%/) {print \$3} else {print \$4} }'
|
||||
)
|
||||
}
|
||||
|
||||
MS_dd()
|
||||
{
|
||||
blocks=\`expr \$3 / 1024\`
|
||||
bytes=\`expr \$3 % 1024\`
|
||||
# Test for ibs, obs and conv feature
|
||||
if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then
|
||||
dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\
|
||||
{ test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\
|
||||
test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null
|
||||
else
|
||||
dd if="\$1" bs=\$2 skip=1 2> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
MS_dd_Progress()
|
||||
{
|
||||
if test x"\$noprogress" = xy; then
|
||||
MS_dd "\$@"
|
||||
return \$?
|
||||
fi
|
||||
file="\$1"
|
||||
offset=\$2
|
||||
length=\$3
|
||||
pos=0
|
||||
bsize=4194304
|
||||
while test \$bsize -gt \$length; do
|
||||
bsize=\`expr \$bsize / 4\`
|
||||
done
|
||||
blocks=\`expr \$length / \$bsize\`
|
||||
bytes=\`expr \$length % \$bsize\`
|
||||
(
|
||||
dd ibs=\$offset skip=1 count=1 2>/dev/null
|
||||
pos=\`expr \$pos \+ \$bsize\`
|
||||
MS_Printf " 0%% " 1>&2
|
||||
if test \$blocks -gt 0; then
|
||||
while test \$pos -le \$length; do
|
||||
dd bs=\$bsize count=1 2>/dev/null
|
||||
pcent=\`expr \$length / 100\`
|
||||
pcent=\`expr \$pos / \$pcent\`
|
||||
if test \$pcent -lt 100; then
|
||||
MS_Printf "\b\b\b\b\b\b\b" 1>&2
|
||||
if test \$pcent -lt 10; then
|
||||
MS_Printf " \$pcent%% " 1>&2
|
||||
else
|
||||
MS_Printf " \$pcent%% " 1>&2
|
||||
fi
|
||||
fi
|
||||
pos=\`expr \$pos \+ \$bsize\`
|
||||
done
|
||||
fi
|
||||
if test \$bytes -gt 0; then
|
||||
dd bs=\$bytes count=1 2>/dev/null
|
||||
fi
|
||||
MS_Printf "\b\b\b\b\b\b\b" 1>&2
|
||||
MS_Printf " 100%% " 1>&2
|
||||
) < "\$file"
|
||||
}
|
||||
|
||||
MS_Help()
|
||||
{
|
||||
cat << EOH >&2
|
||||
Makeself version $MS_VERSION
|
||||
1) Getting help or info about \$0 :
|
||||
\$0 --help Print this message
|
||||
\$0 --info Print embedded info : title, default target directory, embedded script ...
|
||||
\$0 --lsm Print embedded lsm entry (or no LSM)
|
||||
\$0 --list Print the list of files in the archive
|
||||
\$0 --check Checks integrity of the archive
|
||||
\$0 --verify-sig key Verify signature agains a provided key id
|
||||
|
||||
2) Running \$0 :
|
||||
\$0 [options] [--] [additional arguments to embedded script]
|
||||
with following options (in that order)
|
||||
--confirm Ask before running embedded script
|
||||
--quiet Do not print anything except error messages
|
||||
--accept Accept the license
|
||||
--noexec Do not run embedded script (implies --noexec-cleanup)
|
||||
--noexec-cleanup Do not run embedded cleanup script
|
||||
--keep Do not erase target directory after running
|
||||
the embedded script
|
||||
--noprogress Do not show the progress during the decompression
|
||||
--nox11 Do not spawn an xterm
|
||||
--nochown Do not give the target folder to the current user
|
||||
--chown Give the target folder to the current user recursively
|
||||
--nodiskspace Do not check for available disk space
|
||||
--target dir Extract directly to a target directory (absolute or relative)
|
||||
This directory may undergo recursive chown (see --nochown).
|
||||
--tar arg1 [arg2 ...] Access the contents of the archive through the tar command
|
||||
--ssl-pass-src src Use the given src as the source of password to decrypt the data
|
||||
using OpenSSL. See "PASS PHRASE ARGUMENTS" in man openssl.
|
||||
Default is to prompt the user to enter decryption password
|
||||
on the current terminal.
|
||||
--cleanup-args args Arguments to the cleanup script. Wrap in quotes to provide
|
||||
multiple arguments.
|
||||
-- Following arguments will be passed to the embedded script\${helpheader}
|
||||
EOH
|
||||
}
|
||||
|
||||
MS_Verify_Sig()
|
||||
{
|
||||
GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\`
|
||||
MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\`
|
||||
test -x "\$GPG_PATH" || GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\`
|
||||
test -x "\$MKTEMP_PATH" || MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\`
|
||||
offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\`
|
||||
temp_sig=\`mktemp -t XXXXX\`
|
||||
echo \$SIGNATURE | base64 --decode > "\$temp_sig"
|
||||
gpg_output=\`MS_dd "\$1" \$offset \$totalsize | LC_ALL=C "\$GPG_PATH" --verify "\$temp_sig" - 2>&1\`
|
||||
gpg_res=\$?
|
||||
rm -f "\$temp_sig"
|
||||
if test \$gpg_res -eq 0 && test \`echo \$gpg_output | grep -c Good\` -eq 1; then
|
||||
if test \`echo \$gpg_output | grep -c \$sig_key\` -eq 1; then
|
||||
test x"\$quiet" = xn && echo "GPG signature is good" >&2
|
||||
else
|
||||
echo "GPG Signature key does not match" >&2
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
test x"\$quiet" = xn && echo "GPG signature failed to verify" >&2
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
MS_Check()
|
||||
{
|
||||
OLD_PATH="\$PATH"
|
||||
PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
|
||||
MD5_ARG=""
|
||||
MD5_PATH=\`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum\`
|
||||
test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || command -v md5 || type md5\`
|
||||
test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || command -v digest || type digest\`
|
||||
PATH="\$OLD_PATH"
|
||||
|
||||
SHA_PATH=\`exec <&- 2>&-; which shasum || command -v shasum || type shasum\`
|
||||
test -x "\$SHA_PATH" || SHA_PATH=\`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum\`
|
||||
|
||||
if test x"\$quiet" = xn; then
|
||||
MS_Printf "Verifying archive integrity..."
|
||||
fi
|
||||
offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\`
|
||||
fsize=\`cat "\$1" | wc -c | sed "s/ //g"\`
|
||||
if test \$totalsize -ne \`expr \$fsize - \$offset\`; then
|
||||
echo " Unexpected archive size." >&2
|
||||
exit 2
|
||||
fi
|
||||
verb=\$2
|
||||
i=1
|
||||
for s in \$filesizes
|
||||
do
|
||||
crc=\`echo \$CRCsum | cut -d" " -f\$i\`
|
||||
if test -x "\$SHA_PATH"; then
|
||||
if test x"\`basename \$SHA_PATH\`" = xshasum; then
|
||||
SHA_ARG="-a 256"
|
||||
fi
|
||||
sha=\`echo \$SHA | cut -d" " -f\$i\`
|
||||
if test x"\$sha" = x0000000000000000000000000000000000000000000000000000000000000000; then
|
||||
test x"\$verb" = xy && echo " \$1 does not contain an embedded SHA256 checksum." >&2
|
||||
else
|
||||
shasum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$SHA_PATH \$SHA_ARG" | cut -b-64\`;
|
||||
if test x"\$shasum" != x"\$sha"; then
|
||||
echo "Error in SHA256 checksums: \$shasum is different from \$sha" >&2
|
||||
exit 2
|
||||
elif test x"\$quiet" = xn; then
|
||||
MS_Printf " SHA256 checksums are OK." >&2
|
||||
fi
|
||||
crc="0000000000";
|
||||
fi
|
||||
fi
|
||||
if test -x "\$MD5_PATH"; then
|
||||
if test x"\`basename \$MD5_PATH\`" = xdigest; then
|
||||
MD5_ARG="-a md5"
|
||||
fi
|
||||
md5=\`echo \$MD5 | cut -d" " -f\$i\`
|
||||
if test x"\$md5" = x00000000000000000000000000000000; then
|
||||
test x"\$verb" = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2
|
||||
else
|
||||
md5sum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`;
|
||||
if test x"\$md5sum" != x"\$md5"; then
|
||||
echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2
|
||||
exit 2
|
||||
elif test x"\$quiet" = xn; then
|
||||
MS_Printf " MD5 checksums are OK." >&2
|
||||
fi
|
||||
crc="0000000000"; verb=n
|
||||
fi
|
||||
fi
|
||||
if test x"\$crc" = x0000000000; then
|
||||
test x"\$verb" = xy && echo " \$1 does not contain a CRC checksum." >&2
|
||||
else
|
||||
sum1=\`MS_dd_Progress "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\`
|
||||
if test x"\$sum1" != x"\$crc"; then
|
||||
echo "Error in checksums: \$sum1 is different from \$crc" >&2
|
||||
exit 2
|
||||
elif test x"\$quiet" = xn; then
|
||||
MS_Printf " CRC checksums are OK." >&2
|
||||
fi
|
||||
fi
|
||||
i=\`expr \$i + 1\`
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
if test x"\$quiet" = xn; then
|
||||
echo " All good."
|
||||
fi
|
||||
}
|
||||
|
||||
MS_Decompress()
|
||||
{
|
||||
if test x"\$decrypt_cmd" != x""; then
|
||||
{ eval "\$decrypt_cmd" || echo " ... Decryption failed." >&2; } | eval "$GUNZIP_CMD"
|
||||
else
|
||||
eval "$GUNZIP_CMD"
|
||||
fi
|
||||
|
||||
if test \$? -ne 0; then
|
||||
echo " ... Decompression failed." >&2
|
||||
fi
|
||||
}
|
||||
|
||||
UnTAR()
|
||||
{
|
||||
if test x"\$quiet" = xn; then
|
||||
tar \$1vf - $UNTAR_EXTRA 2>&1 || { echo " ... Extraction failed." >&2; kill -15 \$$; }
|
||||
else
|
||||
tar \$1f - $UNTAR_EXTRA 2>&1 || { echo Extraction failed. >&2; kill -15 \$$; }
|
||||
fi
|
||||
}
|
||||
|
||||
MS_exec_cleanup() {
|
||||
if test x"\$cleanup" = xy && test x"\$cleanup_script" != x""; then
|
||||
cleanup=n
|
||||
cd "\$tmpdir"
|
||||
eval "\"\$cleanup_script\" \$scriptargs \$cleanupargs"
|
||||
fi
|
||||
}
|
||||
|
||||
MS_cleanup()
|
||||
{
|
||||
echo 'Signal caught, cleaning up' >&2
|
||||
MS_exec_cleanup
|
||||
cd "\$TMPROOT"
|
||||
rm -rf "\$tmpdir"
|
||||
eval \$finish; exit 15
|
||||
}
|
||||
|
||||
finish=true
|
||||
xterm_loop=
|
||||
noprogress=$NOPROGRESS
|
||||
nox11=$NOX11
|
||||
copy=$COPY
|
||||
ownership=$OWNERSHIP
|
||||
verbose=n
|
||||
cleanup=y
|
||||
cleanupargs=
|
||||
sig_key=
|
||||
|
||||
initargs="\$@"
|
||||
|
||||
while true
|
||||
do
|
||||
case "\$1" in
|
||||
-h | --help)
|
||||
MS_Help
|
||||
exit 0
|
||||
;;
|
||||
-q | --quiet)
|
||||
quiet=y
|
||||
noprogress=y
|
||||
shift
|
||||
;;
|
||||
--accept)
|
||||
accept=y
|
||||
shift
|
||||
;;
|
||||
--info)
|
||||
echo Identification: "\$label"
|
||||
echo Target directory: "\$targetdir"
|
||||
echo Uncompressed size: $USIZE KB
|
||||
echo Compression: $COMPRESS
|
||||
if test x"$ENCRYPT" != x""; then
|
||||
echo Encryption: $ENCRYPT
|
||||
fi
|
||||
echo Date of packaging: $DATE
|
||||
echo Built with Makeself version $MS_VERSION
|
||||
echo Build command was: "$MS_COMMAND"
|
||||
if test x"\$script" != x; then
|
||||
echo Script run after extraction:
|
||||
echo " " \$script \$scriptargs
|
||||
fi
|
||||
if test x"$copy" = xcopy; then
|
||||
echo "Archive will copy itself to a temporary location"
|
||||
fi
|
||||
if test x"$NEED_ROOT" = xy; then
|
||||
echo "Root permissions required for extraction"
|
||||
fi
|
||||
if test x"$KEEP" = xy; then
|
||||
echo "directory \$targetdir is permanent"
|
||||
else
|
||||
echo "\$targetdir will be removed after extraction"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
--dumpconf)
|
||||
echo LABEL=\"\$label\"
|
||||
echo SCRIPT=\"\$script\"
|
||||
echo SCRIPTARGS=\"\$scriptargs\"
|
||||
echo CLEANUPSCRIPT=\"\$cleanup_script\"
|
||||
echo archdirname=\"$archdirname\"
|
||||
echo KEEP=$KEEP
|
||||
echo NOOVERWRITE=$NOOVERWRITE
|
||||
echo COMPRESS=$COMPRESS
|
||||
echo filesizes=\"\$filesizes\"
|
||||
echo totalsize=\"\$totalsize\"
|
||||
echo CRCsum=\"\$CRCsum\"
|
||||
echo MD5sum=\"\$MD5sum\"
|
||||
echo SHAsum=\"\$SHAsum\"
|
||||
echo SKIP=\"\$skip\"
|
||||
exit 0
|
||||
;;
|
||||
--lsm)
|
||||
cat << EOLSM
|
||||
EOF
|
||||
eval "$LSM_CMD"
|
||||
cat << EOF >> "$archname"
|
||||
EOLSM
|
||||
exit 0
|
||||
;;
|
||||
--list)
|
||||
echo Target directory: \$targetdir
|
||||
offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\`
|
||||
for s in \$filesizes
|
||||
do
|
||||
MS_dd "\$0" \$offset \$s | MS_Decompress | UnTAR t
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
--tar)
|
||||
offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\`
|
||||
arg1="\$2"
|
||||
shift 2 || { MS_Help; exit 1; }
|
||||
for s in \$filesizes
|
||||
do
|
||||
MS_dd "\$0" \$offset \$s | MS_Decompress | tar "\$arg1" - "\$@"
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
--check)
|
||||
MS_Check "\$0" y
|
||||
exit 0
|
||||
;;
|
||||
--verify-sig)
|
||||
sig_key="\$2"
|
||||
shift 2 || { MS_Help; exit 1; }
|
||||
MS_Verify_Sig "\$0"
|
||||
;;
|
||||
--confirm)
|
||||
verbose=y
|
||||
shift
|
||||
;;
|
||||
--noexec)
|
||||
script=""
|
||||
cleanup_script=""
|
||||
shift
|
||||
;;
|
||||
--noexec-cleanup)
|
||||
cleanup_script=""
|
||||
shift
|
||||
;;
|
||||
--keep)
|
||||
keep=y
|
||||
shift
|
||||
;;
|
||||
--target)
|
||||
keep=y
|
||||
targetdir="\${2:-.}"
|
||||
shift 2 || { MS_Help; exit 1; }
|
||||
;;
|
||||
--noprogress)
|
||||
noprogress=y
|
||||
shift
|
||||
;;
|
||||
--nox11)
|
||||
nox11=y
|
||||
shift
|
||||
;;
|
||||
--nochown)
|
||||
ownership=n
|
||||
shift
|
||||
;;
|
||||
--chown)
|
||||
ownership=y
|
||||
shift
|
||||
;;
|
||||
--nodiskspace)
|
||||
nodiskspace=y
|
||||
shift
|
||||
;;
|
||||
--xwin)
|
||||
if test "$NOWAIT" = n; then
|
||||
finish="echo Press Return to close this window...; read junk"
|
||||
fi
|
||||
xterm_loop=1
|
||||
shift
|
||||
;;
|
||||
--phase2)
|
||||
copy=phase2
|
||||
shift
|
||||
;;
|
||||
--ssl-pass-src)
|
||||
if test x"$ENCRYPT" != x"openssl"; then
|
||||
echo "Invalid option --ssl-pass-src: \$0 was not encrypted with OpenSSL!" >&2
|
||||
exit 1
|
||||
fi
|
||||
decrypt_cmd="\$decrypt_cmd -pass \$2"
|
||||
shift 2 || { MS_Help; exit 1; }
|
||||
;;
|
||||
--cleanup-args)
|
||||
cleanupargs="\$2"
|
||||
shift 2 || { MS_Help; exit 1; }
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break ;;
|
||||
-*)
|
||||
echo Unrecognized flag : "\$1" >&2
|
||||
MS_Help
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test x"\$quiet" = xy -a x"\$verbose" = xy; then
|
||||
echo Cannot be verbose and quiet at the same time. >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test x"$NEED_ROOT" = xy -a \`id -u\` -ne 0; then
|
||||
echo "Administrative privileges required for this archive (use su or sudo)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test x"\$copy" \!= xphase2; then
|
||||
MS_PrintLicense
|
||||
fi
|
||||
|
||||
case "\$copy" in
|
||||
copy)
|
||||
tmpdir="\$TMPROOT"/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$
|
||||
mkdir "\$tmpdir" || {
|
||||
echo "Could not create temporary directory \$tmpdir" >&2
|
||||
exit 1
|
||||
}
|
||||
SCRIPT_COPY="\$tmpdir/makeself"
|
||||
echo "Copying to a temporary location..." >&2
|
||||
cp "\$0" "\$SCRIPT_COPY"
|
||||
chmod +x "\$SCRIPT_COPY"
|
||||
cd "\$TMPROOT"
|
||||
export USER_PWD="\$tmpdir"
|
||||
exec "\$SCRIPT_COPY" --phase2 -- \$initargs
|
||||
;;
|
||||
phase2)
|
||||
finish="\$finish ; rm -rf \`dirname \$0\`"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"\$nox11" = xn; then
|
||||
if test -t 1; then # Do we have a terminal on stdout?
|
||||
:
|
||||
else
|
||||
if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X?
|
||||
if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable
|
||||
GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology"
|
||||
for a in \$GUESS_XTERMS; do
|
||||
if type \$a >/dev/null 2>&1; then
|
||||
XTERM=\$a
|
||||
break
|
||||
fi
|
||||
done
|
||||
chmod a+x \$0 || echo Please add execution rights on \$0 >&2
|
||||
if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal!
|
||||
exec \$XTERM -e "\$0 --xwin \$initargs"
|
||||
else
|
||||
exec \$XTERM -e "./\$0 --xwin \$initargs"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"\$targetdir" = x.; then
|
||||
tmpdir="."
|
||||
else
|
||||
if test x"\$keep" = xy; then
|
||||
if test x"\$nooverwrite" = xy && test -d "\$targetdir"; then
|
||||
echo "Target directory \$targetdir already exists, aborting." >&2
|
||||
exit 1
|
||||
fi
|
||||
if test x"\$quiet" = xn; then
|
||||
echo "Creating directory \$targetdir" >&2
|
||||
fi
|
||||
tmpdir="\$targetdir"
|
||||
dashp="-p"
|
||||
else
|
||||
tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM"
|
||||
dashp=""
|
||||
fi
|
||||
mkdir \$dashp "\$tmpdir" || {
|
||||
echo 'Cannot create target directory' \$tmpdir >&2
|
||||
echo 'You should try option --target dir' >&2
|
||||
eval \$finish
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
location="\`pwd\`"
|
||||
if test x"\$SETUP_NOCHECK" != x1; then
|
||||
MS_Check "\$0"
|
||||
fi
|
||||
offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\`
|
||||
|
||||
if test x"\$verbose" = xy; then
|
||||
MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] "
|
||||
read yn
|
||||
if test x"\$yn" = xn; then
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"\$quiet" = xn; then
|
||||
# Decrypting with openssl will ask for password,
|
||||
# the prompt needs to start on new line
|
||||
if test x"$ENCRYPT" = x"openssl"; then
|
||||
echo "Decrypting and uncompressing \$label..."
|
||||
else
|
||||
MS_Printf "Uncompressing \$label"
|
||||
fi
|
||||
fi
|
||||
res=3
|
||||
if test x"\$keep" = xn; then
|
||||
trap MS_cleanup 1 2 3 15
|
||||
fi
|
||||
|
||||
if test x"\$nodiskspace" = xn; then
|
||||
leftspace=\`MS_diskspace "\$tmpdir"\`
|
||||
if test -n "\$leftspace"; then
|
||||
if test "\$leftspace" -lt $USIZE; then
|
||||
echo
|
||||
echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2
|
||||
echo "Use --nodiskspace option to skip this check and proceed anyway" >&2
|
||||
if test x"\$keep" = xn; then
|
||||
echo "Consider setting TMPDIR to a directory with more free space."
|
||||
fi
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
for s in \$filesizes
|
||||
do
|
||||
if MS_dd_Progress "\$0" \$offset \$s | MS_Decompress | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then
|
||||
if test x"\$ownership" = xy; then
|
||||
(cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .)
|
||||
fi
|
||||
else
|
||||
echo >&2
|
||||
echo "Unable to decompress \$0" >&2
|
||||
eval \$finish; exit 1
|
||||
fi
|
||||
offset=\`expr \$offset + \$s\`
|
||||
done
|
||||
if test x"\$quiet" = xn; then
|
||||
echo
|
||||
fi
|
||||
|
||||
cd "\$tmpdir"
|
||||
res=0
|
||||
if test x"\$script" != x; then
|
||||
if test x"\$export_conf" = x"y"; then
|
||||
MS_BUNDLE="\$0"
|
||||
MS_LABEL="\$label"
|
||||
MS_SCRIPT="\$script"
|
||||
MS_SCRIPTARGS="\$scriptargs"
|
||||
MS_ARCHDIRNAME="\$archdirname"
|
||||
MS_KEEP="\$KEEP"
|
||||
MS_NOOVERWRITE="\$NOOVERWRITE"
|
||||
MS_COMPRESS="\$COMPRESS"
|
||||
MS_CLEANUP="\$cleanup"
|
||||
export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS
|
||||
export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS
|
||||
fi
|
||||
|
||||
if test x"\$verbose" = x"y"; then
|
||||
MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] "
|
||||
read yn
|
||||
if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then
|
||||
eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?;
|
||||
fi
|
||||
else
|
||||
eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?
|
||||
fi
|
||||
if test "\$res" -ne 0; then
|
||||
test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
MS_exec_cleanup
|
||||
|
||||
if test x"\$keep" = xn; then
|
||||
cd "\$TMPROOT"
|
||||
rm -rf "\$tmpdir"
|
||||
fi
|
||||
eval \$finish; exit \$res
|
||||
EOF
|
||||
@@ -1,158 +0,0 @@
|
||||
.TH "MAKESELF" "1" "2.5.0"
|
||||
.SH "NAME"
|
||||
makeself \- An utility to generate self-extractable archives.
|
||||
.SH "SYNTAX"
|
||||
.B makeself [\fIoptions\fP] archive_dir file_name label
|
||||
.B [\fIstartup_script\fP] [\fIargs\fP]
|
||||
.SH "DESCRIPTION"
|
||||
This program is a free (GPL) shell utility designed to create self-extractable
|
||||
compressed archives from a directory. The resulting file appears as a shell script, and can be launched as is. The archive
|
||||
will then uncompress itself to a temporary directory and an optional arbitrary
|
||||
command will be executed (for example an installation script).
|
||||
.TP
|
||||
Makeself archives also include checksums for integrity self-validation (CRC and/or MD5/SHA256 checksums).
|
||||
.SH "OPTIONS"
|
||||
The following options are supported:
|
||||
.TP 15
|
||||
.B -v, --version
|
||||
Prints out the makeself version number and exits.
|
||||
.TP
|
||||
.B -h, --help
|
||||
Print out help information.
|
||||
.TP
|
||||
.B --tar-quietly
|
||||
Suppress verbose output from the tar command
|
||||
.TP
|
||||
.B --quiet
|
||||
Do not print any messages other than errors
|
||||
.TP
|
||||
.B --gzip
|
||||
Compress using gzip (default if detected).
|
||||
.TP
|
||||
.B --bzip2
|
||||
Compress using bzip2.
|
||||
.TP
|
||||
.B --bzip3
|
||||
Compress using bzip3.
|
||||
.TP
|
||||
.B --pbzip2
|
||||
Compress using pbzip2.
|
||||
.TP
|
||||
.B --xz
|
||||
Compress using xz.
|
||||
.TP
|
||||
.B --lzo
|
||||
Compress using lzop.
|
||||
.TP
|
||||
.B --lz4
|
||||
Compress using lz4.
|
||||
.TP
|
||||
.B --pigz
|
||||
Compress using pigz.
|
||||
.TP
|
||||
.B --zstd
|
||||
Compress using zstd.
|
||||
.TP
|
||||
.B --base64
|
||||
Encode the archive to ASCII in Base64 format instead of compressing (base64 command required).
|
||||
.TP
|
||||
.B --gpg-encrypt
|
||||
Encrypt the archive using GPG. This will prompt for a password to encrypt with.
|
||||
.TP
|
||||
.B --ssl-encrypt
|
||||
Encrypt the archive using OpenSSL. This will prompt for a password to encrypt with.
|
||||
.TP
|
||||
.B --keep-umask
|
||||
Keep the umask set to shell default, rather than overriding when executing the self-extracting archive.
|
||||
.TP
|
||||
.B --compress
|
||||
Compress using the UNIX 'compress' command.
|
||||
.TP
|
||||
.B --nocomp
|
||||
Do not compress the data.
|
||||
.TP
|
||||
.B --complevel lvl
|
||||
Specify the compression level for gzip, bzip2, pbzip2, xz, zstd, lzo or lz4. Defaults to 9.
|
||||
.TP
|
||||
.B --threads num
|
||||
Specify the number of threads to be used by compressors that support parallelization.
|
||||
.TP
|
||||
.B --tar-format opt
|
||||
Specify the tar archive format (default is ustar); you may use any value accepted by your tar command (such as posix, v7, etc).
|
||||
.TP
|
||||
.B --tar-extra opt
|
||||
Append more options to the tar command line.
|
||||
.TP
|
||||
.B --notemp
|
||||
The archive will create archive_dir in the current directory and
|
||||
uncompress in ./archive_dir.
|
||||
.TP
|
||||
.B --copy
|
||||
Upon extraction, the archive will first copy itself to a temporary directory.
|
||||
.TP
|
||||
.B --append
|
||||
Append more files to an existing makeself archive. The label and startup scripts will then be ignored.
|
||||
.TP
|
||||
.B --current
|
||||
Files will be extracted to the current directory. Both --current and --target dir imply --notemp.
|
||||
.TP
|
||||
.B --target dir
|
||||
Extract directly to a target directory. Directory path can be either absolute or relative.
|
||||
.TP
|
||||
.B --header file
|
||||
Specify location of the header script.
|
||||
.TP
|
||||
.B --help-header file
|
||||
Add a header to the archive's help output.
|
||||
.TP
|
||||
.B --cleanup file
|
||||
Specify a cleanup script that executes on interrupt and when finished successfully.
|
||||
.TP
|
||||
.B --follow
|
||||
Follow the symlinks in the archive.
|
||||
.TP
|
||||
.B --noprogress
|
||||
Do not show the progress during the decompression.
|
||||
.TP
|
||||
.B --nooverwrite
|
||||
Do not extract the archive if the target directory already exists.
|
||||
.TP
|
||||
.B --nox11
|
||||
Disable automatic spawn of an xterm if running in X11.
|
||||
.TP
|
||||
.B --nowait
|
||||
Do not wait for user input after executing embedded program from an xterm.
|
||||
.TP
|
||||
.B --nomd5
|
||||
Do not create a MD5 checksum for the archive.
|
||||
.TP
|
||||
.B --sha256
|
||||
Adds a SHA256 checksum for the archive.
|
||||
.TP
|
||||
.B --nocrc
|
||||
Do not create a CRC32 checksum for the archive.
|
||||
.TP
|
||||
.B --lsm file
|
||||
LSM file describing the package.
|
||||
.TP
|
||||
.B --license file
|
||||
Append a license file.
|
||||
.TP
|
||||
.B --packaging-date date
|
||||
Use provided string as the packaging date instead of the current date.
|
||||
.TP
|
||||
.SH "EXAMPLES"
|
||||
Here is an example, assuming the user has a package image stored in a /home/joe/mysoft,
|
||||
and he wants to generate a self-extracting package named mysoft.sh, which will launch
|
||||
the "setup" script initially stored in /home/joe/mysoft:
|
||||
.TP
|
||||
makeself.sh /home/joe/mysoft mysoft.sh "Joe's Nice Software Package" ./setup
|
||||
.TP
|
||||
Here is also how I created the makeself.run archive which contains the Makeself distribution:
|
||||
.TP
|
||||
makeself.sh --notemp makeself makeself.run "Makeself by Stephane Peter" echo "Makeself has extracted itself"
|
||||
.SH "AUTHORS"
|
||||
Makeself has been written by Stephane Peter <megastep@megastep.org>.
|
||||
.BR
|
||||
This man page was originally written by Bartosz Fenski <fenio@o2.pl> for the
|
||||
Debian GNU/Linux distribution (but it may be used by others).
|
||||
@@ -1,776 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Makeself version 2.5.x
|
||||
# by Stephane Peter <megastep@megastep.org>
|
||||
#
|
||||
# Utility to create self-extracting tar.gz archives.
|
||||
# The resulting archive is a file holding the tar.gz archive with
|
||||
# a small Shell script stub that uncompresses the archive to a temporary
|
||||
# directory and then executes a given script from withing that directory.
|
||||
#
|
||||
# Makeself home page: https://makeself.io/ - Version history available on GitHub
|
||||
#
|
||||
# (C) 1998-2023 by Stephane Peter <megastep@megastep.org>
|
||||
#
|
||||
# This software is released under the terms of the GNU GPL version 2 and above
|
||||
# Please read the license at http://www.gnu.org/copyleft/gpl.html
|
||||
# Self-extracting archives created with this script are explictly NOT released under the term of the GPL
|
||||
#
|
||||
|
||||
MS_VERSION=2.5.0
|
||||
MS_COMMAND="$0"
|
||||
unset CDPATH
|
||||
|
||||
for f in ${1+"$@"}; do
|
||||
MS_COMMAND="$MS_COMMAND \\\\
|
||||
\\\"$f\\\""
|
||||
done
|
||||
|
||||
# For Solaris systems
|
||||
if test -d /usr/xpg4/bin; then
|
||||
PATH=/usr/xpg4/bin:$PATH
|
||||
export PATH
|
||||
fi
|
||||
|
||||
# Procedures
|
||||
|
||||
MS_Usage()
|
||||
{
|
||||
echo "Usage: $0 [args] archive_dir file_name label startup_script [script_args]"
|
||||
echo "args can be one or more of the following :"
|
||||
echo " --version | -v : Print out Makeself version number and exit"
|
||||
echo " --help | -h : Print out this help message"
|
||||
echo " --tar-quietly : Suppress verbose output from the tar command"
|
||||
echo " --quiet | -q : Do not print any messages other than errors."
|
||||
echo " --gzip : Compress using gzip (default if detected)"
|
||||
echo " --pigz : Compress with pigz"
|
||||
echo " --zstd : Compress with zstd"
|
||||
echo " --bzip2 : Compress using bzip2 instead of gzip"
|
||||
echo " --pbzip2 : Compress using pbzip2 instead of gzip"
|
||||
echo " --bzip3 : Compress using bzip3 instead of gzip"
|
||||
echo " --xz : Compress using xz instead of gzip"
|
||||
echo " --lzo : Compress using lzop instead of gzip"
|
||||
echo " --lz4 : Compress using lz4 instead of gzip"
|
||||
echo " --compress : Compress using the UNIX 'compress' command"
|
||||
echo " --complevel lvl : Compression level for gzip pigz zstd xz lzo lz4 bzip2 pbzip2 and bzip3 (default 9)"
|
||||
echo " --threads thds : Number of threads to be used by compressors that support parallelization."
|
||||
echo " Omit to use compressor's default. Most useful (and required) for opting"
|
||||
echo " into xz's threading, usually with '--threads=0' for all available cores."
|
||||
echo " pbzip2 and pigz are parallel by default, and setting this value allows"
|
||||
echo " limiting the number of threads they use."
|
||||
echo " --base64 : Instead of compressing, encode the data using base64"
|
||||
echo " --gpg-encrypt : Instead of compressing, encrypt the data using GPG"
|
||||
echo " --gpg-asymmetric-encrypt-sign"
|
||||
echo " : Instead of compressing, asymmetrically encrypt and sign the data using GPG"
|
||||
echo " --gpg-extra opt : Append more options to the gpg command line"
|
||||
echo " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL"
|
||||
echo " --ssl-passwd pass : Use the given password to encrypt the data using OpenSSL"
|
||||
echo " --ssl-pass-src src : Use the given src as the source of password to encrypt the data"
|
||||
echo " using OpenSSL. See \"PASS PHRASE ARGUMENTS\" in man openssl."
|
||||
echo " If this option is not supplied, the user will be asked to enter"
|
||||
echo " encryption password on the current terminal."
|
||||
echo " --ssl-no-md : Do not use \"-md\" option not supported by older OpenSSL."
|
||||
echo " --nochown : Do not give the target folder to the current user (default)"
|
||||
echo " --chown : Give the target folder to the current user recursively"
|
||||
echo " --nocomp : Do not compress the data"
|
||||
echo " --notemp : The archive will create archive_dir in the current directory"
|
||||
echo " and uncompress in ./archive_dir"
|
||||
echo " Note: persistent archives do not strictly require a startup_script"
|
||||
echo " --needroot : Check that the root user is extracting the archive before proceeding"
|
||||
echo " --copy : Upon extraction, the archive will first copy itself to"
|
||||
echo " a temporary directory"
|
||||
echo " --append : Append more files to an existing Makeself archive"
|
||||
echo " The label and startup scripts will then be ignored"
|
||||
echo " --target dir : Extract directly to a target directory"
|
||||
echo " directory path can be either absolute or relative"
|
||||
echo " --current : Files will be extracted to the current directory"
|
||||
echo " Both --current and --target imply --notemp, and do not require a startup_script"
|
||||
echo " --nooverwrite : Do not extract the archive if the specified target directory exists"
|
||||
echo " --tar-format opt : Specify a tar archive format (default is ustar)"
|
||||
echo " --tar-extra opt : Append more options to the tar command line"
|
||||
echo " --untar-extra opt : Append more options to the during the extraction of the tar archive"
|
||||
echo " --nomd5 : Don't calculate an MD5 for archive"
|
||||
echo " --nocrc : Don't calculate a CRC for archive"
|
||||
echo " --sha256 : Compute a SHA256 checksum for the archive"
|
||||
echo " --header file : Specify location of the header script"
|
||||
echo " --cleanup file : Specify a cleanup script that executes on interrupt and when finished successfully."
|
||||
echo " --follow : Follow the symlinks in the archive"
|
||||
echo " --noprogress : Do not show the progress during the decompression"
|
||||
echo " --nox11 : Disable automatic spawn of a xterm"
|
||||
echo " --nowait : Do not wait for user input after executing embedded"
|
||||
echo " program from an xterm"
|
||||
echo " --sign passphrase : Signature private key to sign the package with"
|
||||
echo " --lsm file : LSM file describing the package"
|
||||
echo " --license file : Append a license file"
|
||||
echo " --help-header file : Add a header to the archive's --help output"
|
||||
echo " --packaging-date date"
|
||||
echo " : Use provided string as the packaging date"
|
||||
echo " instead of the current date."
|
||||
echo
|
||||
echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive."
|
||||
echo " --export-conf : Export configuration variables to startup_script"
|
||||
echo
|
||||
echo "Do not forget to give a fully qualified startup script name"
|
||||
echo "(i.e. with a ./ prefix if inside the archive)."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Default settings
|
||||
if type gzip >/dev/null 2>&1; then
|
||||
COMPRESS=gzip
|
||||
elif type compress >/dev/null 2>&1; then
|
||||
COMPRESS=compress
|
||||
else
|
||||
echo "ERROR: missing commands: gzip, compress" >&2
|
||||
MS_Usage
|
||||
fi
|
||||
ENCRYPT=n
|
||||
PASSWD=""
|
||||
PASSWD_SRC=""
|
||||
OPENSSL_NO_MD=n
|
||||
COMPRESS_LEVEL=9
|
||||
DEFAULT_THREADS=123456 # Sentinel value
|
||||
THREADS=$DEFAULT_THREADS
|
||||
KEEP=n
|
||||
CURRENT=n
|
||||
NOX11=n
|
||||
NOWAIT=n
|
||||
APPEND=n
|
||||
TAR_QUIETLY=n
|
||||
KEEP_UMASK=n
|
||||
QUIET=n
|
||||
NOPROGRESS=n
|
||||
COPY=none
|
||||
NEED_ROOT=n
|
||||
TAR_ARGS=rvf
|
||||
TAR_FORMAT=ustar
|
||||
TAR_EXTRA=""
|
||||
GPG_EXTRA=""
|
||||
DU_ARGS=-ks
|
||||
HEADER=`dirname "$0"`/makeself-header.sh
|
||||
SIGNATURE=""
|
||||
TARGETDIR=""
|
||||
NOOVERWRITE=n
|
||||
DATE=`LC_ALL=C date`
|
||||
EXPORT_CONF=n
|
||||
SHA256=n
|
||||
OWNERSHIP=n
|
||||
SIGN=n
|
||||
GPG_PASSPHRASE=""
|
||||
|
||||
# LSM file stuff
|
||||
LSM_CMD="echo No LSM. >> \"\$archname\""
|
||||
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
--version | -v)
|
||||
echo Makeself version $MS_VERSION
|
||||
exit 0
|
||||
;;
|
||||
--pbzip2)
|
||||
COMPRESS=pbzip2
|
||||
shift
|
||||
;;
|
||||
--bzip3)
|
||||
COMPRESS=bzip3
|
||||
shift
|
||||
;;
|
||||
--bzip2)
|
||||
COMPRESS=bzip2
|
||||
shift
|
||||
;;
|
||||
--gzip)
|
||||
COMPRESS=gzip
|
||||
shift
|
||||
;;
|
||||
--pigz)
|
||||
COMPRESS=pigz
|
||||
shift
|
||||
;;
|
||||
--zstd)
|
||||
COMPRESS=zstd
|
||||
shift
|
||||
;;
|
||||
--xz)
|
||||
COMPRESS=xz
|
||||
shift
|
||||
;;
|
||||
--lzo)
|
||||
COMPRESS=lzo
|
||||
shift
|
||||
;;
|
||||
--lz4)
|
||||
COMPRESS=lz4
|
||||
shift
|
||||
;;
|
||||
--compress)
|
||||
COMPRESS=compress
|
||||
shift
|
||||
;;
|
||||
--base64)
|
||||
COMPRESS=base64
|
||||
shift
|
||||
;;
|
||||
--gpg-encrypt)
|
||||
COMPRESS=gpg
|
||||
shift
|
||||
;;
|
||||
--gpg-asymmetric-encrypt-sign)
|
||||
COMPRESS=gpg-asymmetric
|
||||
shift
|
||||
;;
|
||||
--gpg-extra)
|
||||
GPG_EXTRA="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--ssl-encrypt)
|
||||
ENCRYPT=openssl
|
||||
shift
|
||||
;;
|
||||
--ssl-passwd)
|
||||
PASSWD=$2
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--ssl-pass-src)
|
||||
PASSWD_SRC=$2
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--ssl-no-md)
|
||||
OPENSSL_NO_MD=y
|
||||
shift
|
||||
;;
|
||||
--nocomp)
|
||||
COMPRESS=none
|
||||
shift
|
||||
;;
|
||||
--complevel)
|
||||
COMPRESS_LEVEL="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--threads)
|
||||
THREADS="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--nochown)
|
||||
OWNERSHIP=n
|
||||
shift
|
||||
;;
|
||||
--chown)
|
||||
OWNERSHIP=y
|
||||
shift
|
||||
;;
|
||||
--notemp)
|
||||
KEEP=y
|
||||
shift
|
||||
;;
|
||||
--copy)
|
||||
COPY=copy
|
||||
shift
|
||||
;;
|
||||
--current)
|
||||
CURRENT=y
|
||||
KEEP=y
|
||||
shift
|
||||
;;
|
||||
--tar-format)
|
||||
TAR_FORMAT="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--tar-extra)
|
||||
TAR_EXTRA="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--untar-extra)
|
||||
UNTAR_EXTRA="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--target)
|
||||
TARGETDIR="$2"
|
||||
KEEP=y
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--sign)
|
||||
SIGN=y
|
||||
GPG_PASSPHRASE="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--nooverwrite)
|
||||
NOOVERWRITE=y
|
||||
shift
|
||||
;;
|
||||
--needroot)
|
||||
NEED_ROOT=y
|
||||
shift
|
||||
;;
|
||||
--header)
|
||||
HEADER="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--cleanup)
|
||||
CLEANUP_SCRIPT="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--license)
|
||||
# We need to escape all characters having a special meaning in double quotes
|
||||
LICENSE=$(sed 's/\\/\\\\/g; s/"/\\\"/g; s/`/\\\`/g; s/\$/\\\$/g' "$2")
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--follow)
|
||||
TAR_ARGS=rvhf
|
||||
DU_ARGS=-ksL
|
||||
shift
|
||||
;;
|
||||
--noprogress)
|
||||
NOPROGRESS=y
|
||||
shift
|
||||
;;
|
||||
--nox11)
|
||||
NOX11=y
|
||||
shift
|
||||
;;
|
||||
--nowait)
|
||||
NOWAIT=y
|
||||
shift
|
||||
;;
|
||||
--nomd5)
|
||||
NOMD5=y
|
||||
shift
|
||||
;;
|
||||
--sha256)
|
||||
SHA256=y
|
||||
shift
|
||||
;;
|
||||
--nocrc)
|
||||
NOCRC=y
|
||||
shift
|
||||
;;
|
||||
--append)
|
||||
APPEND=y
|
||||
shift
|
||||
;;
|
||||
--lsm)
|
||||
LSM_CMD="awk 1 \"$2\" >> \"\$archname\""
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--packaging-date)
|
||||
DATE="$2"
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
;;
|
||||
--help-header)
|
||||
HELPHEADER=`sed -e "s/'/'\\\\\''/g" $2`
|
||||
shift 2 || { MS_Usage; exit 1; }
|
||||
[ -n "$HELPHEADER" ] && HELPHEADER="$HELPHEADER
|
||||
"
|
||||
;;
|
||||
--tar-quietly)
|
||||
TAR_QUIETLY=y
|
||||
shift
|
||||
;;
|
||||
--keep-umask)
|
||||
KEEP_UMASK=y
|
||||
shift
|
||||
;;
|
||||
--export-conf)
|
||||
EXPORT_CONF=y
|
||||
shift
|
||||
;;
|
||||
-q | --quiet)
|
||||
QUIET=y
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
MS_Usage
|
||||
;;
|
||||
-*)
|
||||
echo Unrecognized flag : "$1"
|
||||
MS_Usage
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test $# -lt 1; then
|
||||
MS_Usage
|
||||
else
|
||||
if test -d "$1"; then
|
||||
archdir="$1"
|
||||
else
|
||||
echo "Directory $1 does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
archname="$2"
|
||||
|
||||
if test "$QUIET" = "y" || test "$TAR_QUIETLY" = "y"; then
|
||||
if test "$TAR_ARGS" = "rvf"; then
|
||||
TAR_ARGS="rf"
|
||||
elif test "$TAR_ARGS" = "rvhf"; then
|
||||
TAR_ARGS="rhf"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$APPEND" = y; then
|
||||
if test $# -lt 2; then
|
||||
MS_Usage
|
||||
fi
|
||||
|
||||
# Gather the info from the original archive
|
||||
OLDENV=`sh "$archname" --dumpconf`
|
||||
if test $? -ne 0; then
|
||||
echo "Unable to update archive: $archname" >&2
|
||||
exit 1
|
||||
else
|
||||
eval "$OLDENV"
|
||||
OLDSKIP=`expr $SKIP + 1`
|
||||
fi
|
||||
else
|
||||
if test "$KEEP" = n -a $# = 3; then
|
||||
echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2
|
||||
echo >&2
|
||||
MS_Usage
|
||||
fi
|
||||
# We don't want to create an absolute directory unless a target directory is defined
|
||||
if test "$CURRENT" = y; then
|
||||
archdirname="."
|
||||
elif test x"$TARGETDIR" != x; then
|
||||
archdirname="$TARGETDIR"
|
||||
else
|
||||
archdirname=`basename "$1"`
|
||||
fi
|
||||
|
||||
if test $# -lt 3; then
|
||||
MS_Usage
|
||||
fi
|
||||
|
||||
LABEL="$3"
|
||||
SCRIPT="$4"
|
||||
test "x$SCRIPT" = x || shift 1
|
||||
shift 3
|
||||
SCRIPTARGS="$*"
|
||||
fi
|
||||
|
||||
if test "$KEEP" = n -a "$CURRENT" = y; then
|
||||
echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $COMPRESS in
|
||||
gzip)
|
||||
GZIP_CMD="gzip -c$COMPRESS_LEVEL"
|
||||
GUNZIP_CMD="gzip -cd"
|
||||
;;
|
||||
pigz)
|
||||
GZIP_CMD="pigz -$COMPRESS_LEVEL"
|
||||
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated
|
||||
GZIP_CMD="$GZIP_CMD --processes $THREADS"
|
||||
fi
|
||||
GUNZIP_CMD="gzip -cd"
|
||||
;;
|
||||
zstd)
|
||||
GZIP_CMD="zstd -$COMPRESS_LEVEL"
|
||||
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated
|
||||
GZIP_CMD="$GZIP_CMD --threads=$THREADS"
|
||||
fi
|
||||
GUNZIP_CMD="zstd -cd"
|
||||
;;
|
||||
pbzip2)
|
||||
GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL"
|
||||
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated
|
||||
GZIP_CMD="$GZIP_CMD -p$THREADS"
|
||||
fi
|
||||
GUNZIP_CMD="bzip2 -d"
|
||||
;;
|
||||
bzip3)
|
||||
# Map the compression level to a block size in MiB as 2^(level-1).
|
||||
BZ3_COMPRESS_LEVEL=`echo "2^($COMPRESS_LEVEL-1)" | bc`
|
||||
GZIP_CMD="bzip3 -b$BZ3_COMPRESS_LEVEL"
|
||||
if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated
|
||||
GZIP_CMD="$GZIP_CMD -j$THREADS"
|
||||
fi
|
||||
JOBS=`echo "10-$COMPRESS_LEVEL" | bc`
|
||||
GUNZIP_CMD="bzip3 -dj$JOBS"
|
||||
;;
|
||||
bzip2)
|
||||
GZIP_CMD="bzip2 -$COMPRESS_LEVEL"
|
||||
GUNZIP_CMD="bzip2 -d"
|
||||
;;
|
||||
xz)
|
||||
GZIP_CMD="xz -c$COMPRESS_LEVEL"
|
||||
# Must opt-in by specifying a value since not all versions of xz support threads
|
||||
if test $THREADS -ne $DEFAULT_THREADS; then
|
||||
GZIP_CMD="$GZIP_CMD --threads=$THREADS"
|
||||
fi
|
||||
GUNZIP_CMD="xz -d"
|
||||
;;
|
||||
lzo)
|
||||
GZIP_CMD="lzop -c$COMPRESS_LEVEL"
|
||||
GUNZIP_CMD="lzop -d"
|
||||
;;
|
||||
lz4)
|
||||
GZIP_CMD="lz4 -c$COMPRESS_LEVEL"
|
||||
GUNZIP_CMD="lz4 -d"
|
||||
;;
|
||||
base64)
|
||||
GZIP_CMD="base64"
|
||||
GUNZIP_CMD="base64 --decode -i -"
|
||||
;;
|
||||
gpg)
|
||||
GZIP_CMD="gpg $GPG_EXTRA -ac -z$COMPRESS_LEVEL"
|
||||
GUNZIP_CMD="gpg -d"
|
||||
ENCRYPT="gpg"
|
||||
;;
|
||||
gpg-asymmetric)
|
||||
GZIP_CMD="gpg $GPG_EXTRA -z$COMPRESS_LEVEL -es"
|
||||
GUNZIP_CMD="gpg --yes -d"
|
||||
ENCRYPT="gpg"
|
||||
;;
|
||||
compress)
|
||||
GZIP_CMD="compress -fc"
|
||||
GUNZIP_CMD="(type compress >/dev/null 2>&1 && compress -fcd || gzip -cd)"
|
||||
;;
|
||||
none)
|
||||
GZIP_CMD="cat"
|
||||
GUNZIP_CMD="cat"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$ENCRYPT" = x"openssl"; then
|
||||
if test x"$APPEND" = x"y"; then
|
||||
echo "Appending to existing archive is not compatible with OpenSSL encryption." >&2
|
||||
fi
|
||||
|
||||
ENCRYPT_CMD="openssl enc -aes-256-cbc -salt"
|
||||
DECRYPT_CMD="openssl enc -aes-256-cbc -d"
|
||||
|
||||
if test x"$OPENSSL_NO_MD" != x"y"; then
|
||||
ENCRYPT_CMD="$ENCRYPT_CMD -md sha256"
|
||||
DECRYPT_CMD="$DECRYPT_CMD -md sha256"
|
||||
fi
|
||||
|
||||
if test -n "$PASSWD_SRC"; then
|
||||
ENCRYPT_CMD="$ENCRYPT_CMD -pass $PASSWD_SRC"
|
||||
elif test -n "$PASSWD"; then
|
||||
ENCRYPT_CMD="$ENCRYPT_CMD -pass pass:$PASSWD"
|
||||
fi
|
||||
fi
|
||||
|
||||
tmpfile="${TMPDIR:-/tmp}/mkself$$"
|
||||
|
||||
if test -f "$HEADER"; then
|
||||
oldarchname="$archname"
|
||||
archname="$tmpfile"
|
||||
# Generate a fake header to count its lines
|
||||
SKIP=0
|
||||
. "$HEADER"
|
||||
SKIP=`cat "$tmpfile" |wc -l`
|
||||
# Get rid of any spaces
|
||||
SKIP=`expr $SKIP`
|
||||
rm -f "$tmpfile"
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "Header is $SKIP lines long" >&2
|
||||
fi
|
||||
archname="$oldarchname"
|
||||
else
|
||||
echo "Unable to open header file: $HEADER" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$QUIET" = "n"; then
|
||||
echo
|
||||
fi
|
||||
|
||||
if test "$APPEND" = n; then
|
||||
if test -f "$archname"; then
|
||||
echo "WARNING: Overwriting existing file: $archname" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
USIZE=`du $DU_ARGS "$archdir" | awk '{print $1}'`
|
||||
|
||||
if test "." = "$archdirname"; then
|
||||
if test "$KEEP" = n; then
|
||||
archdirname="makeself-$$-`date +%Y%m%d%H%M%S`"
|
||||
fi
|
||||
fi
|
||||
|
||||
test -d "$archdir" || { echo "Error: $archdir does not exist."; rm -f "$tmpfile"; exit 1; }
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "About to compress $USIZE KB of data..."
|
||||
echo "Adding files to archive named \"$archname\"..."
|
||||
fi
|
||||
|
||||
# See if we have GNU tar
|
||||
TAR=`exec <&- 2>&-; which gtar || command -v gtar || type gtar`
|
||||
test -x "$TAR" || TAR=`exec <&- 2>&-; which bsdtar || command -v bsdtar || type bsdtar`
|
||||
test -x "$TAR" || TAR=tar
|
||||
|
||||
tmparch="${TMPDIR:-/tmp}/mkself$$.tar"
|
||||
(
|
||||
if test "$APPEND" = "y"; then
|
||||
tail -n "+$OLDSKIP" "$archname" | eval "$GUNZIP_CMD" > "$tmparch"
|
||||
fi
|
||||
cd "$archdir"
|
||||
# "Determining if a directory is empty"
|
||||
# https://www.etalabs.net/sh_tricks.html
|
||||
find . \
|
||||
\( \
|
||||
! -type d \
|
||||
-o \
|
||||
\( -links 2 -exec sh -c '
|
||||
is_empty () (
|
||||
cd "$1"
|
||||
set -- .[!.]* ; test -f "$1" && return 1
|
||||
set -- ..?* ; test -f "$1" && return 1
|
||||
set -- * ; test -f "$1" && return 1
|
||||
return 0
|
||||
)
|
||||
is_empty "$0"' {} \; \
|
||||
\) \
|
||||
\) -print \
|
||||
| LC_ALL=C sort \
|
||||
| sed 's/./\\&/g' \
|
||||
| xargs $TAR $TAR_EXTRA --format $TAR_FORMAT -$TAR_ARGS "$tmparch"
|
||||
) || {
|
||||
echo "ERROR: failed to create temporary archive: $tmparch"
|
||||
rm -f "$tmparch" "$tmpfile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
USIZE=`du $DU_ARGS "$tmparch" | awk '{print $1}'`
|
||||
|
||||
eval "$GZIP_CMD" <"$tmparch" >"$tmpfile" || {
|
||||
echo "ERROR: failed to create temporary file: $tmpfile"
|
||||
rm -f "$tmparch" "$tmpfile"
|
||||
exit 1
|
||||
}
|
||||
rm -f "$tmparch"
|
||||
|
||||
if test x"$ENCRYPT" = x"openssl"; then
|
||||
echo "About to encrypt archive \"$archname\"..."
|
||||
{ eval "$ENCRYPT_CMD -in $tmpfile -out ${tmpfile}.enc" && mv -f ${tmpfile}.enc $tmpfile; } || \
|
||||
{ echo Aborting: could not encrypt temporary file: "$tmpfile".; rm -f "$tmpfile"; exit 1; }
|
||||
fi
|
||||
|
||||
fsize=`cat "$tmpfile" | wc -c | tr -d " "`
|
||||
|
||||
# Compute the checksums
|
||||
|
||||
shasum=0000000000000000000000000000000000000000000000000000000000000000
|
||||
md5sum=00000000000000000000000000000000
|
||||
crcsum=0000000000
|
||||
|
||||
if test "$NOCRC" = y; then
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "skipping crc at user request"
|
||||
fi
|
||||
else
|
||||
crcsum=`CMD_ENV=xpg4 cksum < "$tmpfile" | sed -e 's/ /Z/' -e 's/ /Z/' | cut -dZ -f1`
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "CRC: $crcsum"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$SHA256" = y; then
|
||||
SHA_PATH=`exec <&- 2>&-; which shasum || command -v shasum || type shasum`
|
||||
if test -x "$SHA_PATH"; then
|
||||
shasum=`eval "$SHA_PATH -a 256" < "$tmpfile" | cut -b-64`
|
||||
else
|
||||
SHA_PATH=`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum`
|
||||
shasum=`eval "$SHA_PATH" < "$tmpfile" | cut -b-64`
|
||||
fi
|
||||
if test "$QUIET" = "n"; then
|
||||
if test -x "$SHA_PATH"; then
|
||||
echo "SHA256: $shasum"
|
||||
else
|
||||
echo "SHA256: none, SHA command not found"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$NOMD5" = y; then
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "Skipping md5sum at user request"
|
||||
fi
|
||||
else
|
||||
# Try to locate a MD5 binary
|
||||
OLD_PATH=$PATH
|
||||
PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
|
||||
MD5_ARG=""
|
||||
MD5_PATH=`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum`
|
||||
test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || command -v md5 || type md5`
|
||||
test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which digest || command -v digest || type digest`
|
||||
PATH=$OLD_PATH
|
||||
if test -x "$MD5_PATH"; then
|
||||
if test `basename ${MD5_PATH}`x = digestx; then
|
||||
MD5_ARG="-a md5"
|
||||
fi
|
||||
md5sum=`eval "$MD5_PATH $MD5_ARG" < "$tmpfile" | cut -b-32`
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "MD5: $md5sum"
|
||||
fi
|
||||
else
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "MD5: none, MD5 command not found"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$SIGN" = y; then
|
||||
GPG_PATH=`exec <&- 2>&-; which gpg || command -v gpg || type gpg`
|
||||
if test -x "$GPG_PATH"; then
|
||||
SIGNATURE=`$GPG_PATH --pinentry-mode=loopback --batch --yes $GPG_EXTRA --passphrase "$GPG_PASSPHRASE" --output - --detach-sig $tmpfile | base64 | tr -d \\\\n`
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "Signature: $SIGNATURE"
|
||||
fi
|
||||
else
|
||||
echo "Missing gpg command" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
totalsize=0
|
||||
for size in $fsize;
|
||||
do
|
||||
totalsize=`expr $totalsize + $size`
|
||||
done
|
||||
|
||||
if test "$APPEND" = y; then
|
||||
mv "$archname" "$archname".bak || exit
|
||||
|
||||
# Prepare entry for new archive
|
||||
filesizes="$fsize"
|
||||
CRCsum="$crcsum"
|
||||
MD5sum="$md5sum"
|
||||
SHAsum="$shasum"
|
||||
Signature="$SIGNATURE"
|
||||
# Generate the header
|
||||
. "$HEADER"
|
||||
# Append the new data
|
||||
cat "$tmpfile" >> "$archname"
|
||||
|
||||
chmod +x "$archname"
|
||||
rm -f "$archname".bak
|
||||
if test "$QUIET" = "n"; then
|
||||
echo "Self-extractable archive \"$archname\" successfully updated."
|
||||
fi
|
||||
else
|
||||
filesizes="$fsize"
|
||||
CRCsum="$crcsum"
|
||||
MD5sum="$md5sum"
|
||||
SHAsum="$shasum"
|
||||
Signature="$SIGNATURE"
|
||||
|
||||
# Generate the header
|
||||
. "$HEADER"
|
||||
|
||||
# Append the compressed tar data after the stub
|
||||
if test "$QUIET" = "n"; then
|
||||
echo
|
||||
fi
|
||||
cat "$tmpfile" >> "$archname"
|
||||
chmod +x "$archname"
|
||||
if test "$QUIET" = "n"; then
|
||||
echo Self-extractable archive \"$archname\" successfully created.
|
||||
fi
|
||||
fi
|
||||
rm -f "$tmpfile"
|
||||
Reference in New Issue
Block a user