Compare commits
156 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
700183ff64 | ||
|
|
e9daed7143 | ||
|
|
adba4d3421 | ||
|
|
8a1a314eb5 | ||
|
|
1026800376 | ||
|
|
a800767f0b | ||
|
|
6d07ffcaad | ||
|
|
e8efec928a | ||
|
|
af62a307e5 | ||
|
|
21630d6e33 | ||
|
|
738a16514d | ||
|
|
6debfe73b8 | ||
|
|
ce7ea49481 | ||
|
|
7a6197f04d | ||
|
|
491c15ec63 | ||
|
|
3b94661c90 | ||
|
|
e9463d990e | ||
|
|
90cc4520d8 | ||
|
|
4cf4efffbe | ||
|
|
071ae09e1b | ||
|
|
21b0f768f1 | ||
|
|
fe774756c0 | ||
|
|
6ab4bf3a5a | ||
|
|
0a7db3b4bb | ||
|
|
9849dc2ecc | ||
|
|
b82c840e04 | ||
|
|
d762884775 | ||
|
|
33e0149dbf | ||
|
|
f742fc599a | ||
|
|
3a98b86d33 | ||
|
|
09ee2325b3 | ||
|
|
8354251917 | ||
|
|
08111df903 | ||
|
|
d9cd6ded90 | ||
|
|
8935cb0ac5 | ||
|
|
9eb611b388 | ||
|
|
6a198d8930 | ||
|
|
712b5a5cb9 | ||
|
|
8e10997fd5 | ||
|
|
ee35d426b3 | ||
|
|
8676e9e349 | ||
|
|
efbd445a79 | ||
|
|
f23935e6c9 | ||
|
|
edc87953a5 | ||
|
|
3cfc706a74 | ||
|
|
231eebd18b | ||
|
|
73d75f1769 | ||
|
|
7bec0cc7f4 | ||
|
|
1de80457ad | ||
|
|
d53d7ac473 | ||
|
|
60b1579628 | ||
|
|
5d344ed6a9 | ||
|
|
8ae235c6bd | ||
|
|
a6be08228b | ||
|
|
d08e73e999 | ||
|
|
33dab8b349 | ||
|
|
9ba63a0c17 | ||
|
|
b0a626303b | ||
|
|
96afe6dd29 | ||
|
|
1c71b690c4 | ||
|
|
dc51577bbb | ||
|
|
34b3b1d14c | ||
|
|
d092bf87c8 | ||
|
|
8c322ba04b | ||
|
|
c1dd12c611 | ||
|
|
6b2d4e720a | ||
|
|
2f9031e3fb | ||
|
|
df325c5f5e | ||
|
|
a1055d68be | ||
|
|
6b2fc8b0a5 | ||
|
|
10b0d1c64f | ||
|
|
2fdb4a5e69 | ||
|
|
8f4cb31962 | ||
|
|
3b62345e5a | ||
|
|
f564167e9d | ||
|
|
67e3d5c0f8 | ||
|
|
80d3118e7d | ||
|
|
39e00baf57 | ||
|
|
3378fb5a93 | ||
|
|
7e481182b1 | ||
|
|
6b0d2dad68 | ||
|
|
8b8a7bcc99 | ||
|
|
a4a3c1998b | ||
|
|
1ecf4db983 | ||
|
|
8adb3026f7 | ||
|
|
c9c320c2ca | ||
|
|
4902d10167 | ||
|
|
04890fecd5 | ||
|
|
28c68c9043 | ||
|
|
6f6778f3a3 | ||
|
|
bedf2d0a6b | ||
|
|
fe3430df09 | ||
|
|
8af23fb3fe | ||
|
|
f124199acc | ||
|
|
831d4c6384 | ||
|
|
48780950bd | ||
|
|
e5ad10ab09 | ||
|
|
09f52a444e | ||
|
|
a40b66063a | ||
|
|
8997d71e0c | ||
|
|
04da524e3d | ||
|
|
7f434f374a | ||
|
|
82c9fc028a | ||
|
|
135505bf22 | ||
|
|
d55ca84ccd | ||
|
|
85e636d0e6 | ||
|
|
29a028ad89 | ||
|
|
a886046e64 | ||
|
|
915f60710d | ||
|
|
567aaf9733 | ||
|
|
8d2b2acb62 | ||
|
|
49d8a0425c | ||
|
|
0acb2020c8 | ||
|
|
5338b8ecc7 | ||
|
|
fb44e027b3 | ||
|
|
ad987595bb | ||
|
|
3049a8cf5d | ||
|
|
f6f9ed1810 | ||
|
|
b33d1e0013 | ||
|
|
a3f6d44b52 | ||
|
|
931e5c7942 | ||
|
|
2c90cfd41b | ||
|
|
bf33567af2 | ||
|
|
4418bfa3f9 | ||
|
|
a239db84ff | ||
|
|
9a50bf50ea | ||
|
|
ea0c82fd95 | ||
|
|
c8663b8994 | ||
|
|
0cf78e4fbf | ||
|
|
65210543b7 | ||
|
|
13fa3fc771 | ||
|
|
f6f86334ed | ||
|
|
74093f29b1 | ||
|
|
466424229d | ||
|
|
6c31c321e6 | ||
|
|
1f46c8860f | ||
|
|
21ffcf4cd5 | ||
|
|
4a94b7237f | ||
|
|
8c0e316993 | ||
|
|
582292c5d1 | ||
|
|
d87c63b870 | ||
|
|
4be4774994 | ||
|
|
5f89c1d61a | ||
|
|
73ad75ed34 | ||
|
|
bc0c10f829 | ||
|
|
dfe6a3c534 | ||
|
|
75fa94aba8 | ||
|
|
8b4bdf2fc8 | ||
|
|
16f3590843 | ||
|
|
9323868f05 | ||
|
|
3555ec84ad | ||
|
|
32ffa70cb1 | ||
|
|
2d0dd7d7e9 | ||
|
|
27493c7f4f | ||
|
|
1021427900 | ||
|
|
8cb6619ae8 |
27
.github/workflows/autobuild.yml
vendored
27
.github/workflows/autobuild.yml
vendored
@@ -68,8 +68,6 @@ jobs:
|
||||
getOffline "files/p3/configs"
|
||||
getLKMs "files/p3/lkms"
|
||||
getTheme "files/p1/boot/grub"
|
||||
getBuildrootx "brx"
|
||||
getBuildroots "brs"
|
||||
|
||||
# Export Dependencies Version to env
|
||||
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
||||
@@ -91,6 +89,8 @@ jobs:
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
getBuildrootx "brx"
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="${{ inputs.version }}-dev"
|
||||
@@ -120,6 +120,7 @@ jobs:
|
||||
|
||||
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"
|
||||
@@ -138,7 +139,13 @@ jobs:
|
||||
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
|
||||
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
||||
|
||||
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
|
||||
@@ -155,7 +162,7 @@ jobs:
|
||||
# Cleanup
|
||||
- name: Cleanup
|
||||
run: |
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
|
||||
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc"
|
||||
|
||||
# Build incremental
|
||||
- name: Build Stable Image
|
||||
@@ -163,6 +170,8 @@ jobs:
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
getBuildroots "brs"
|
||||
|
||||
# Modify Source File
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="${{ inputs.version }}-dev"
|
||||
@@ -192,7 +201,7 @@ jobs:
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
#cp -f "brs/initrd-arc" "files/p3/initrd-arc"
|
||||
createArc
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
@@ -211,7 +220,13 @@ jobs:
|
||||
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
|
||||
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
||||
|
||||
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
|
||||
|
||||
46
.github/workflows/build.yml
vendored
46
.github/workflows/build.yml
vendored
@@ -53,7 +53,7 @@ jobs:
|
||||
uses: actions/checkout@main
|
||||
|
||||
- name: Delete releases and workflows runs
|
||||
if: ${{ inputs.clean == true }}
|
||||
if: ${{ inputs.clean }}
|
||||
uses: ophub/delete-releases-workflows@main
|
||||
with:
|
||||
delete_releases: true
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
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 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
|
||||
@@ -96,6 +96,7 @@ jobs:
|
||||
getTheme "files/p1/boot/grub"
|
||||
getBuildrootx "brx"
|
||||
getBuildroots "brs"
|
||||
cp -f "files/initrd/opt/arc/grub.img.gz" "grub.img.gz"
|
||||
|
||||
# Export Dependencies Version to env
|
||||
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
|
||||
@@ -113,7 +114,7 @@ jobs:
|
||||
|
||||
# Build incremental
|
||||
- name: Build Next Image
|
||||
if: ${{ inputs.next == true }}
|
||||
if: ${{ inputs.next }}
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
@@ -130,6 +131,7 @@ jobs:
|
||||
|
||||
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}"
|
||||
|
||||
@@ -146,6 +148,7 @@ jobs:
|
||||
|
||||
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"
|
||||
@@ -164,32 +167,36 @@ jobs:
|
||||
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
|
||||
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
||||
|
||||
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 }}
|
||||
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 }}.vhdx.zip" arc.vhdx
|
||||
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.ova" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
|
||||
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 == true }}
|
||||
if: ${{ inputs.stable }}
|
||||
run: |
|
||||
. scripts/func.sh
|
||||
|
||||
@@ -206,6 +213,7 @@ jobs:
|
||||
|
||||
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}"
|
||||
|
||||
@@ -222,7 +230,7 @@ jobs:
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
#cp -f "brs/initrd-arc" "files/p3/initrd-arc"
|
||||
createArc
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
|
||||
echo "Copying files"
|
||||
@@ -241,22 +249,26 @@ jobs:
|
||||
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
|
||||
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
|
||||
|
||||
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 == true }}
|
||||
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
|
||||
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
|
||||
|
||||
# Publish a release if is a tag
|
||||
@@ -273,12 +285,12 @@ jobs:
|
||||
- ${{ inputs.notice }}
|
||||
|
||||
### Information:
|
||||
- Full Changelog is available in my Discord
|
||||
- Changelog is available in my Discord
|
||||
- Discord Account for Arc Patch needed
|
||||
|
||||
### Versions:
|
||||
- stable: Stable Image (Full Image, all dependencies are included, less hardware support)
|
||||
- next: Next Image (Full Image, all dependencies are included, more hardware support, new features to test)
|
||||
${{ 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' || '' }}
|
||||
|
||||
### Dependencies:
|
||||
- Addons: ${{ env.ADDONTAG }}
|
||||
@@ -287,8 +299,8 @@ jobs:
|
||||
- Patches: ${{ env.PATCHTAG }}
|
||||
- Custom: ${{ env.CUSTOMTAG }}
|
||||
- LKMs: ${{ env.LKMTAG }}
|
||||
- Buildroot Stable: ${{ env.BRSTAG }}
|
||||
- Buildroot Next: ${{ env.BRXTAG }}
|
||||
${{ inputs.stable && format('- Buildroot Stable: {0}', env.BRSTAG) || '' }}
|
||||
${{ inputs.next && format('- Buildroot Next: {0}', env.BRXTAG) || '' }}
|
||||
|
||||
### Release
|
||||
- ${{ env.BUILD_TIME }}
|
||||
|
||||
2
.github/workflows/data.yml
vendored
2
.github/workflows/data.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
||||
|
||||
TAG=""
|
||||
if [ "${PRERELEASE}" = "true" ]; then
|
||||
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
|
||||
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -E 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
|
||||
else
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
|
||||
@@ -5,11 +5,13 @@ version: "3"
|
||||
tasks:
|
||||
build-img-n:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-gen-n.sh
|
||||
|
||||
build-img-s:
|
||||
cmds:
|
||||
- git reset --hard
|
||||
- git pull
|
||||
- ./img-gen-s.sh
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,11 +13,10 @@
|
||||
. "${ARC_PATH}/include/compat.sh"
|
||||
. "${ARC_PATH}/arc-functions.sh"
|
||||
|
||||
# Get Keymap and Timezone Config
|
||||
# Get Keymap and Timezone and check System
|
||||
onlineCheck
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
# Check for System
|
||||
systemCheck
|
||||
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
|
||||
@@ -60,7 +59,7 @@ BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
###############################################################################
|
||||
# Mounts backtitle dynamically
|
||||
function backtitle() {
|
||||
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
|
||||
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ -n "${ARC_VERSION}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
|
||||
BACKTITLE+="${MODEL:-(Model)} | "
|
||||
BACKTITLE+="${PRODUCTVER:-(Version)} | "
|
||||
BACKTITLE+="${IPCON:-(IP)} | "
|
||||
@@ -89,11 +88,7 @@ function backtitlep() {
|
||||
# Model Selection
|
||||
function arcModel() {
|
||||
STEP="model"
|
||||
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
|
||||
updateConfigs
|
||||
else
|
||||
checkHardwareID
|
||||
fi
|
||||
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
|
||||
dialog --backtitle "$(backtitlep)" --title "Model" \
|
||||
--infobox "Reading Models..." 3 25
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
@@ -125,9 +120,9 @@ function arcModel() {
|
||||
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
|
||||
[ "${M}" = "SA6400" ] && HBAS="x"
|
||||
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
|
||||
[[ "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_CACHE="+" || M_2_CACHE="x"
|
||||
[[ "${M}" = "DS718+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_CACHE="+" || M_2_CACHE="x"
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" ]] && M_2_CACHE=""
|
||||
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
|
||||
[[ "${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
|
||||
@@ -170,26 +165,22 @@ function arcModel() {
|
||||
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0) # ok-button
|
||||
0)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return 1
|
||||
[ -z "${resp}" ] && return
|
||||
break
|
||||
;;
|
||||
1) # cancel-button -> Show all Models
|
||||
1)
|
||||
[ ${RESTRICT} -eq 1 ] && RESTRICT=0 || RESTRICT=1
|
||||
;;
|
||||
2) # help-button -> Exit
|
||||
return 1
|
||||
break
|
||||
;;
|
||||
3) # extra-button -> Platform Info
|
||||
3)
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
|
||||
dialog --backtitle "$(backtitlep)" --colors \
|
||||
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
|
||||
;;
|
||||
255) # ESC -> Exit
|
||||
return 1
|
||||
*)
|
||||
return
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@@ -248,12 +239,12 @@ 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 "Version" --backtitle "$(backtitlep)" \
|
||||
--no-items --menu "Choose DSM Version" 7 30 0 ${ITEMS} \
|
||||
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitlep)" \
|
||||
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return 0
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return 1
|
||||
[ -z "${resp}" ] && return
|
||||
if [ "${PRODUCTVER}" != "${resp}" ]; then
|
||||
PRODUCTVER="${resp}"
|
||||
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
|
||||
@@ -264,10 +255,6 @@ function arcVersion() {
|
||||
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
dialog --backtitle "$(backtitlep)" --title "Version" \
|
||||
--infobox "Reading DSM Build..." 3 25
|
||||
@@ -286,8 +273,8 @@ function arcVersion() {
|
||||
PREV="${V}"
|
||||
done < <(echo "${PVS}")
|
||||
DSMPVS="$(cat ${TMP_PATH}/versions)"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Version" \
|
||||
--no-items --menu "Choose a DSM Build" 0 0 0 ${DSMPVS} \
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "DSM Build" \
|
||||
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
|
||||
2>${TMP_PATH}/resp
|
||||
RET=$?
|
||||
[ ${RET} -ne 0 ] && return
|
||||
@@ -320,10 +307,18 @@ function arcVersion() {
|
||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" >/dev/null 2>&1 || true
|
||||
rm -f "${USER_UP_PATH}/"*.tar >/dev/null 2>&1 || true
|
||||
fi
|
||||
MSG="Do you want to try Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Automated Mode" \
|
||||
--yesno "${MSG}" 6 55
|
||||
[ $? -eq 0 ] && ARCMODE="automated" || ARCMODE="config"
|
||||
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" \
|
||||
--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
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
|
||||
VALID="true"
|
||||
fi
|
||||
@@ -336,6 +331,13 @@ function arcVersion() {
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
done < <(readConfigMap "platforms.${PLATFORM}.synoinfo" "${P_FILE}")
|
||||
# Reset Modules
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
mergeConfigModules "$(getAllModules "${PLATFORM}" "${KVERP}" | awk '{print $1}')" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Check Addons for Platform
|
||||
ADDONS="$(readConfigKey "addons" "${USER_CONFIG_FILE}")"
|
||||
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
|
||||
@@ -369,6 +371,9 @@ function arcVersion() {
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
initConfigKey "addons.arcdns" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ ${SASDRIVES} -gt 0 ] && [ "${DT}" = "false" ]; then
|
||||
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
while IFS=': ' read -r ADDON PARAM; do
|
||||
[ -z "${ADDON}" ] && continue
|
||||
@@ -376,20 +381,12 @@ function arcVersion() {
|
||||
deleteConfigKey "addons.\"${ADDON}\"" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
fi
|
||||
# Check for Only Version
|
||||
if [ "${ONLYVERSION}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ONLYVERSION="false"
|
||||
return 0
|
||||
return
|
||||
else
|
||||
arcPatch
|
||||
fi
|
||||
@@ -399,7 +396,7 @@ function arcVersion() {
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
sleep 5
|
||||
return 1
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -410,39 +407,37 @@ function arcPatch() {
|
||||
# Read Model Values
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" = "automated" ]; 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}"
|
||||
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
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --clear --backtitle "$(backtitlep)" \
|
||||
--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"
|
||||
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"
|
||||
fi
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return 1
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
|
||||
--infobox "Arc Patch successful!" 3 30
|
||||
sleep 2
|
||||
SN="$(generateSerial "${MODEL}" "true")"
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
|
||||
--infobox "Arc Patch failed!" 3 30
|
||||
sleep 2
|
||||
SN="$(generateSerial "${MODEL}" "false")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
SN="$(generateSerial "${MODEL}" "true")"
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
# Generate random Serial
|
||||
SN="$(generateSerial "${MODEL}" "false")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 3 ]; then
|
||||
@@ -460,8 +455,8 @@ function arcPatch() {
|
||||
done
|
||||
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
arcSettings
|
||||
}
|
||||
@@ -477,12 +472,14 @@ function arcSettings() {
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
|
||||
# Get Network Config for Loader
|
||||
STEP="network"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
|
||||
--infobox "Generating Network Config..." 3 40
|
||||
sleep 2
|
||||
getnet
|
||||
[ $? -ne 0 ] && return 1
|
||||
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
|
||||
if [ "${ONLYPATCH}" = "true" ]; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
@@ -490,13 +487,13 @@ function arcSettings() {
|
||||
return 0
|
||||
fi
|
||||
# Select Portmap for Loader
|
||||
if [ "${DT}" = "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
|
||||
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
|
||||
STEP="storagemap"
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
|
||||
--infobox "Generating Storage Map..." 3 40
|
||||
sleep 2
|
||||
getmapSelection
|
||||
[ $? -ne 0 ] && return 1
|
||||
[ $? -ne 0 ] && return
|
||||
fi
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" = "config" ]; then
|
||||
@@ -505,14 +502,14 @@ function arcSettings() {
|
||||
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
|
||||
--infobox "Loading Addons Table..." 3 40
|
||||
addonSelection
|
||||
[ $? -ne 0 ] && return 1
|
||||
[ $? -ne 0 ] && 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 1
|
||||
[ $? -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
|
||||
@@ -531,7 +528,7 @@ function arcSettings() {
|
||||
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 ${MODELNIC} are used by Arc Patch." 6 80
|
||||
--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
|
||||
@@ -566,12 +563,12 @@ function arcSettings() {
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return 1
|
||||
[ -z "${resp}" ] && return
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
arcSummary
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
dialog --clear --no-items --backtitle "$(backtitle)"
|
||||
return 1
|
||||
return
|
||||
fi
|
||||
else
|
||||
# Build Loader
|
||||
@@ -662,13 +659,13 @@ function arcSummary() {
|
||||
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
|
||||
RET=$?
|
||||
case ${RET} in
|
||||
0) # ok-button
|
||||
0)
|
||||
make
|
||||
;;
|
||||
3) # extra-button
|
||||
3)
|
||||
return 0
|
||||
;;
|
||||
255) # ESC
|
||||
255)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
@@ -705,14 +702,14 @@ function make() {
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return 1
|
||||
return
|
||||
fi
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
|
||||
(
|
||||
livepatch
|
||||
sleep 3
|
||||
) 2>&1 | dialog --backtitle "$(backtitlep)" --colors --title "Build Loader" \
|
||||
--progressbox "Magical things happening..." 20 70
|
||||
--progressbox "Patching DSM Files..." 20 70
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
|
||||
--infobox "Configuration issue found.\nCould not build Loader!\nExit." 5 40
|
||||
@@ -720,11 +717,10 @@ function make() {
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return 1
|
||||
return
|
||||
fi
|
||||
STEP="boot"
|
||||
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ -f "${MOD_ZIMAGE_FILE}" ] && [ -f "${MOD_RDGZ_FILE}" ]; then
|
||||
MODELID=$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')
|
||||
MODELID="$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')"
|
||||
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
|
||||
arcFinish
|
||||
@@ -735,13 +731,14 @@ function make() {
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 2
|
||||
return 1
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Finish Building Loader
|
||||
function arcFinish() {
|
||||
STEP="boot"
|
||||
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
|
||||
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${MODELID}" ]; then
|
||||
@@ -757,11 +754,11 @@ function arcFinish() {
|
||||
2 "No - I want to make changes" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return 1
|
||||
[ -z "${resp}" ] && return
|
||||
if [ ${resp} -eq 1 ]; then
|
||||
boot
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
return 0
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -803,8 +800,7 @@ function boot() {
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
|
||||
--infobox "Booting DSM...\nPlease stay patient!" 4 25
|
||||
sleep 2
|
||||
clear
|
||||
exec boot.sh
|
||||
exec reboot
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -819,7 +815,7 @@ if [ "${ARCMODE}" = "update" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Update" \
|
||||
--infobox "Update is not possible in Offline Mode!" 5 40
|
||||
sleep 3
|
||||
reboot
|
||||
exec reboot
|
||||
fi
|
||||
elif [ "${ARCMODE}" = "automated" ]; then
|
||||
# Check for Custom Build
|
||||
@@ -828,25 +824,27 @@ elif [ "${ARCMODE}" = "automated" ]; then
|
||||
else
|
||||
make
|
||||
fi
|
||||
else
|
||||
elif [ "${ARCMODE}" = "config" ]; then
|
||||
[ "${CONFDONE}" = "true" ] && NEXT="2" || NEXT="1"
|
||||
[ "${BUILDDONE}" = "true" ] && NEXT="3" || NEXT="1"
|
||||
while true; do
|
||||
echo "= \"\Z4===== Main =====\Zn \" " >"${TMP_PATH}/menu"
|
||||
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
|
||||
echo "= \"\Z4===== Main =====\Zn \" " >"${TMP_PATH}/menu"
|
||||
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then
|
||||
echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${CONFDONE}" = "true" ] && [ -n "${IPCON}" ]; then
|
||||
if [ "${CONFDONE}" = "true" ] && [ -f "${MOD_ZIMAGE_FILE}" ] && [ -f "${MOD_RDGZ_FILE}" ]; then
|
||||
echo "2 \"Rebuild Loader \" " >>"${TMP_PATH}/menu"
|
||||
elif [ "${CONFDONE}" = "true" ]; then
|
||||
echo "2 \"Build Loader \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${BUILDDONE}" = "true" ]; then
|
||||
echo "3 \"Boot Loader \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
echo "= \"\Z4===== Info =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== Info =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "a \"Sysinfo \" " >>"${TMP_PATH}/menu"
|
||||
echo "A \"Networkdiag \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== System ====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== System ====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${CONFDONE}" = "true" ]; then
|
||||
if [ "${ARCOPTS}" = "true" ]; then
|
||||
echo "4 \"\Z1Hide Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
@@ -854,7 +852,7 @@ else
|
||||
echo "4 \"\Z1Show Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${ARCOPTS}" = "true" ]; then
|
||||
echo "= \"\Z4==== Arc DSM ====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4==== Arc DSM ====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "b \"Addons \" " >>"${TMP_PATH}/menu"
|
||||
echo "d \"Modules \" " >>"${TMP_PATH}/menu"
|
||||
echo "e \"Version \" " >>"${TMP_PATH}/menu"
|
||||
@@ -889,8 +887,8 @@ else
|
||||
echo "6 \"\Z1Show Boot Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${BOOTOPTS}" = "true" ]; then
|
||||
echo "= \"\Z4===== Boot =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== Boot =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "E \"eMMC Boot Support: \Z4${EMMCBOOT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${DIRECTBOOT}" = "false" ]; then
|
||||
echo "i \"Boot IP Waittime: \Z4${BOOTIPWAIT}\Zn \" " >>"${TMP_PATH}/menu"
|
||||
@@ -903,14 +901,16 @@ else
|
||||
echo "7 \"\Z1Show DSM Options\Zn \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
if [ "${DSMOPTS}" = "true" ]; then
|
||||
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "j \"Cmdline \" " >>"${TMP_PATH}/menu"
|
||||
echo "k \"Synoinfo \" " >>"${TMP_PATH}/menu"
|
||||
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
|
||||
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"
|
||||
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
echo "M \"Mount DSM Storage Pool \" " >>"${TMP_PATH}/menu"
|
||||
fi
|
||||
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"
|
||||
@@ -942,7 +942,7 @@ else
|
||||
fi
|
||||
echo "= \"\Z4===== Misc =====\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "x \"Backup/Restore/Recovery \" " >>"${TMP_PATH}/menu"
|
||||
[ "${ARCOFFLINE}" != "true" ] && echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
|
||||
[ "${ARCOFFLINE}" = "false" ] && echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
|
||||
echo "I \"Power/Service Menu \" " >>"${TMP_PATH}/menu"
|
||||
echo "V \"Credits \" " >>"${TMP_PATH}/menu"
|
||||
|
||||
@@ -1032,12 +1032,10 @@ else
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVER}" ]; then
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
mergeConfigModules "$(getAllModules "${PLATFORM}" "${KVERP}" | awk '{print $1}')" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
@@ -1109,16 +1107,18 @@ else
|
||||
esac
|
||||
done
|
||||
clear
|
||||
else
|
||||
exec reboot
|
||||
fi
|
||||
|
||||
# Inform user
|
||||
echo -e "Call \033[1;34marc.sh\033[0m to configure Loader"
|
||||
echo
|
||||
echo -e "Web Terminal: \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m"
|
||||
echo -e "Web Filemanager: \033[1;34mhttp://${IPCON}:${DUFSPORT:-7304}\033[0m"
|
||||
echo
|
||||
echo -e "SSH Access:"
|
||||
echo -e "IP: \033[1;34m${IPCON}\033[0m"
|
||||
echo -e "User: \033[1;34mroot\033[0m"
|
||||
echo -e "Password: \033[1;34marc\033[0m"
|
||||
echo
|
||||
echo -e "Web Terminal: \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m"
|
||||
echo -e "Web Filemanager: \033[1;34mhttp://${IPCON}:${DUFSPORT}\033[0m"
|
||||
echo
|
||||
|
||||
@@ -15,8 +15,8 @@ ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
|
||||
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
|
||||
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
|
||||
|
||||
# Print Title centralized
|
||||
clear
|
||||
@@ -55,9 +55,10 @@ LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
|
||||
CPU="$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))"
|
||||
RAMTOTAL="$(awk '/MemTotal:/ {printf "%.0f\n", $2 / 1024 / 1024 + 0.5}' /proc/meminfo 2>/dev/null)"
|
||||
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
|
||||
DSMINFO="$(readConfigKey "boot.dsminfo" "${USER_CONFIG_FILE}")"
|
||||
SYSTEMINFO="$(readConfigKey "boot.systeminfo" "${USER_CONFIG_FILE}")"
|
||||
DISKINFO="$(readConfigKey "boot.diskinfo" "${USER_CONFIG_FILE}")"
|
||||
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}")"
|
||||
|
||||
if [ "${DSMINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mDSM:\033[0m"
|
||||
@@ -78,6 +79,11 @@ if [ "${DISKINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mDisks:\033[0m"
|
||||
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
|
||||
fi
|
||||
if [ "${HWIDINFO}" = "true" ]; then
|
||||
echo -e "\033[1;37mHardwareID:\033[0m"
|
||||
echo -e "HWID: \033[1;37m$(genHWID)\033[0m"
|
||||
echo
|
||||
fi
|
||||
|
||||
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
|
||||
HASATA=0
|
||||
@@ -102,26 +108,40 @@ 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['vid']="${VID:-"0x46f4"}" # Sanity check
|
||||
CMDLINE['pid']="${PID:-"0x0001"}" # Sanity check
|
||||
CMDLINE['sn']="${SN}"
|
||||
CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}"
|
||||
CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check
|
||||
CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check
|
||||
CMDLINE["sn"]="${SN}"
|
||||
|
||||
# Boot Cmdline
|
||||
if grep -q "force_junior" /proc/cmdline; then
|
||||
CMDLINE['force_junior']=""
|
||||
CMDLINE["force_junior"]=""
|
||||
fi
|
||||
if grep -q "recovery" /proc/cmdline; then
|
||||
CMDLINE['force_junior']=""
|
||||
CMDLINE['recovery']=""
|
||||
CMDLINE["force_junior"]=""
|
||||
CMDLINE["recovery"]=""
|
||||
fi
|
||||
if [ ${EFI} -eq 1 ]; then
|
||||
CMDLINE['withefi']=""
|
||||
CMDLINE["withefi"]=""
|
||||
else
|
||||
CMDLINE['noefi']=""
|
||||
CMDLINE["noefi"]=""
|
||||
fi
|
||||
|
||||
# DSM Cmdline
|
||||
@@ -132,10 +152,10 @@ 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
|
||||
@@ -149,32 +169,37 @@ else
|
||||
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['rootwait']=""
|
||||
CMDLINE['loglevel']="15"
|
||||
CMDLINE['log_buf_len']="32M"
|
||||
CMDLINE['panic']="${KERNELPANIC:-0}"
|
||||
CMDLINE['pcie_aspm']="off"
|
||||
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
|
||||
#[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
|
||||
CMDLINE["root"]="/dev/md0"
|
||||
CMDLINE["loglevel"]="15"
|
||||
CMDLINE["log_buf_len"]="32M"
|
||||
CMDLINE["rootwait"]=""
|
||||
CMDLINE["panic"]="${KERNELPANIC:-0}"
|
||||
|
||||
# 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
|
||||
# if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "sdhci"; then
|
||||
# [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
|
||||
# CMDLINE['modprobe.blacklist']+="sdhci,sdhci_pci,sdhci_acpi"
|
||||
# if ! echo "${CMDLINE["modprobe.blacklist"]}" | grep -q "sdhci"; then
|
||||
# [ ! "${CMDLINE["modprobe.blacklist"]}" = "" ] && CMDLINE["modprobe.blacklist"]+=","
|
||||
# CMDLINE["modprobe.blacklist"]+="sdhci,sdhci_pci,sdhci_acpi"
|
||||
# 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
|
||||
fi
|
||||
# CMDLINE['kvm.ignore_msrs']="1"
|
||||
@@ -186,19 +211,19 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
|
||||
CMDLINE["SASmodel"]="1"
|
||||
fi
|
||||
|
||||
# Cmdline NIC Settings
|
||||
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
|
||||
# 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}
|
||||
[ -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 '[:lower:]' '[:upper:]')" || NIC=$((${NIC} + 1))
|
||||
[ -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}"
|
||||
CMDLINE["netif_num"]="${NIC}"
|
||||
|
||||
# Read user network settings
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
@@ -212,7 +237,7 @@ done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Prepare command line
|
||||
CMDLINE_LINE=""
|
||||
for KEY in ${!CMDLINE[@]}; do
|
||||
for KEY in "${!CMDLINE[@]}"; do
|
||||
VALUE="${CMDLINE[${KEY}]}"
|
||||
CMDLINE_LINE+=" ${KEY}"
|
||||
[ -n "${VALUE}" ] && CMDLINE_LINE+="=${VALUE}"
|
||||
@@ -226,7 +251,9 @@ 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"
|
||||
_bootwait || true
|
||||
if ! _bootwait; then
|
||||
exit 0
|
||||
fi
|
||||
echo -e "\033[1;34mReboot with Directboot\033[0m"
|
||||
reboot
|
||||
exit 0
|
||||
@@ -253,8 +280,8 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 1))
|
||||
IP="$(getIP ${N})"
|
||||
COUNT=$((COUNT + 1))
|
||||
IP="$(getIP "${N}")"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
@@ -276,9 +303,11 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
_bootwait || true
|
||||
if ! _bootwait; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DSMLOGO="$(readConfigKey "boot.dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then
|
||||
[[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON=""
|
||||
[ -n "${IPCON}" ] && URL="http://${IPCON}:5000" || URL="http://find.synology.com/"
|
||||
@@ -288,12 +317,21 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
|
||||
for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
|
||||
if [ -w "/dev/${T}" ]; then
|
||||
[ -n "${IPCON}" ] && echo -e "Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\n" >"/dev/${T}" 2>/dev/null || echo -e "Try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\nNo IP found.\033[0m\n" >"/dev/${T}" 2>/dev/null
|
||||
[ -n "${IPCON}" ] && echo -e "Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes - Network will be unreachable until DSM boot.\033[0m\n" >"/dev/${T}" 2>/dev/null \
|
||||
|| echo -e "Try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes - Network will be unreachable until DSM boot.\nNo IP found - DSM will not work properly!\033[0m\n" >"/dev/${T}" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# # Unload all network interfaces
|
||||
# for D in $(realpath /sys/class/net/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
|
||||
|
||||
# Unload all graphics drivers
|
||||
# for D in $(lsmod | grep -E '^(nouveau|amdgpu|radeon|i915)' | awk '{print $1}'); do rmmod -f "${D}" 2>/dev/null || true; done
|
||||
# for I in $(find /sys/devices -name uevent -exec bash -c 'cat {} 2>/dev/null | grep -Eq "PCI_CLASS=0?30[0|1|2]00" && dirname {}' \;); do
|
||||
# [ -e ${I}/reset ] && cat ${I}/vendor >/dev/null | grep -iq 0x10de && echo 1 >${I}/reset || true # Proc open nvidia driver when booting
|
||||
# done
|
||||
|
||||
echo -e "\033[1;37mLoading DSM Kernel...\033[0m"
|
||||
# Executes DSM kernel via KEXEC
|
||||
KEXECARGS="-a"
|
||||
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ ${EFI} -eq 1 ]; then
|
||||
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
|
||||
@@ -302,7 +340,6 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
echo -e "\033[1;37mBooting DSM...\033[0m"
|
||||
# Boot to DSM
|
||||
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
read_u8() {
|
||||
dd if=$1 bs=1 skip=$(($2)) count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
|
||||
dd if="${1}" bs=1 skip="$((${2}))" count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
|
||||
}
|
||||
read_u32() {
|
||||
dd if=$1 bs=1 skip=$(($2)) count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
|
||||
dd if="${1}" bs=1 skip="$((${2}))" count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
|
||||
}
|
||||
|
||||
set -x
|
||||
setup_size=$(read_u8 $1 0x1f1)
|
||||
payload_offset=$(read_u32 $1 0x248)
|
||||
payload_length=$(read_u32 $1 0x24c)
|
||||
inner_pos=$((($setup_size + 1) * 512))
|
||||
setup_size=$(read_u8 "${1}" 0x1f1)
|
||||
payload_offset=$(read_u32 "${1}" 0x248)
|
||||
payload_length=$(read_u32 "${1}" 0x24c)
|
||||
inner_pos=$(((setup_size + 1) * 512))
|
||||
|
||||
tail -c+$(($inner_pos + 1)) $1 | tail -c+$(($payload_offset + 1)) | head -c $(($payload_length)) | head -c $(($payload_length - 4)) | unlzma >$2
|
||||
tail -c+$(($inner_pos + 1)) "${1}" | tail -c+$(($payload_offset + 1)) | head -c "${payload_length}" | head -c $(($payload_length - 4)) | unlzma >"${2}"
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Calculate the amount of space needed to run the kernel, including room for
|
||||
# the .bss and .brk sections.
|
||||
#
|
||||
# Usage:
|
||||
# objdump -h a.out | sh calc_run_size.sh
|
||||
|
||||
NUM='\([0-9a-fA-F]*[ \t]*\)'
|
||||
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/\1\4/p')
|
||||
if [ -z "$OUT" ]; then
|
||||
echo "Never found .bss or .brk file offset" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OUT=$(echo ${OUT# })
|
||||
sizeA=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
offsetA=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
sizeB=$(printf "%d" 0x${OUT%% *})
|
||||
OUT=${OUT#* }
|
||||
offsetB=$(printf "%d" 0x${OUT%% *})
|
||||
|
||||
run_size=$((${offsetA} + ${sizeA} + ${sizeB}))
|
||||
|
||||
# BFD linker shows the same file offset in ELF.
|
||||
if [ "${offsetA}" -ne "${offsetB}" ]; then
|
||||
# Gold linker shows them as consecutive.
|
||||
endB=$((${offsetB} + ${sizeB}))
|
||||
if [ "$endB" != "$run_size" ]; then
|
||||
printf "sizeA: 0x%x\n" ${sizeA} >&2
|
||||
printf "offsetA: 0x%x\n" ${offsetA} >&2
|
||||
printf "sizeB: 0x%x\n" ${sizeB} >&2
|
||||
printf "offsetB: 0x%x\n" ${offsetB} >&2
|
||||
echo ".bss and .brk are non-contiguous" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "%d\n" ${run_size}
|
||||
exit 0
|
||||
Binary file not shown.
@@ -8,6 +8,7 @@ function availableAddons() {
|
||||
fi
|
||||
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
local ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
|
||||
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})
|
||||
|
||||
@@ -26,6 +26,20 @@ function readConfigKey() {
|
||||
[ "${RESULT}" = "null" ] && echo "" || echo "${RESULT}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Write to yaml config file
|
||||
# 1 - Modules
|
||||
# 2 - Path of yaml config file
|
||||
function mergeConfigModules() {
|
||||
local MS="ARCMOD\n${1// /\\n}"
|
||||
local L="$(echo -en "${MS}" | awk '{print "modules."$1":"}')"
|
||||
local xmlfile=$(mktemp)
|
||||
echo -en "${L}" | yq -p p -o=yaml >"${xmlfile}"
|
||||
deleteConfigKey "modules.\"ARCMOD\"" "${xmlfile}"
|
||||
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' "${2}" "${xmlfile}" 2>/dev/null
|
||||
rm -f "${xmlfile}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Write to yaml config file if key not exists
|
||||
# 1 - Path of Key
|
||||
|
||||
@@ -43,7 +43,7 @@ EXTRACTOR_PATH="${PART3_PATH}/extractor"
|
||||
EXTRACTOR_BIN="syno_extract_system_patch"
|
||||
|
||||
HTTPPORT=$(grep -i '^HTTP_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${HTTPPORT}" ] && HTTPPORT=7080 || true
|
||||
[ -z "${HTTPPORT}" ] && HTTPPORT=8080 || true
|
||||
DUFSPORT=$(grep -i '^DUFS_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
[ -z "${DUFSPORT}" ] && DUFSPORT=7304 || true
|
||||
TTYDPORT=$(grep -i '^TTYD_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
|
||||
|
||||
@@ -136,7 +136,7 @@ function generateMacAddress() {
|
||||
[ ${I} -lt ${NUM} ] && MACS+=" "
|
||||
done
|
||||
|
||||
MACS="$(echo "${MACS}" | tr '[:lower:]' '[:upper:]')"
|
||||
MACS="$(echo "${MACS}" | tr '[:upper:]' '[:lower:]')"
|
||||
echo "${MACS}"
|
||||
return 0
|
||||
}
|
||||
@@ -229,7 +229,7 @@ function _set_conf_kv() {
|
||||
# sort netif busid
|
||||
function _sort_netif() {
|
||||
local ETHLIST=""
|
||||
local ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
|
||||
local ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
for N in ${ETHX}; do
|
||||
local MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
|
||||
local BUS="$(ethtool -i ${N} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
|
||||
@@ -277,7 +277,7 @@ function getBus() {
|
||||
# 1 - ethN
|
||||
function getIP() {
|
||||
local IP=""
|
||||
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
@@ -497,29 +497,34 @@ function onlineCheck() {
|
||||
TIMEZONE="$(curl -m 10 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f2)"
|
||||
KEYMAP="$(curl -m 10 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
|
||||
if [ "${KEYMAP}" = "ua" ]; then
|
||||
rm -rf "${PART3_PATH}"
|
||||
poweroff
|
||||
rm -rf "${PART3_PATH}" && exec poweroff
|
||||
fi
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${REGION}" ] && [ -n "${TIMEZONE}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
[ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -eq 0 ] && NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
[ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -gt 0 ] && NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
|
||||
writeConfigKey "time.region" "${REGION}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "time.timezone" "${TIMEZONE}" "${USER_CONFIG_FILE}"
|
||||
updateOffline
|
||||
else
|
||||
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
|
||||
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
[ -n "${TIMEZONE}" ] && [ -n "${REGION}" ] && ln -sf "/usr/share/zoneinfo/${REGION}/${TIMEZONE}" /etc/localtime
|
||||
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${LAYOUT}" ]; then
|
||||
[ -n "${KEYMAP}" ] && KEYMAP="$(echo ${KEYMAP} | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]' | tr -d '[:punct:]' | tr -d '[:digit:]')"
|
||||
[ -n "${KEYMAP}" ] && writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="us"
|
||||
loadkeys ${KEYMAP}
|
||||
if loadkeys "${KEYMAP:-us}" 2>/dev/null; then
|
||||
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
KEYMAP="us"
|
||||
loadkeys "${KEYMAP}" 2>/dev/null
|
||||
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
updateOffline
|
||||
else
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -584,13 +589,18 @@ function check_port() {
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Unmount new boot loader disk
|
||||
# Unmount disks
|
||||
function __umountNewBlDisk() {
|
||||
umount "${TMP_PATH}/sdX1" 2>/dev/null
|
||||
umount "${TMP_PATH}/sdX2" 2>/dev/null
|
||||
umount "${TMP_PATH}/sdX3" 2>/dev/null
|
||||
}
|
||||
|
||||
function __umountDSMRootDisk() {
|
||||
umount "${TMP_PATH}/mdX"
|
||||
rm -rf "${TMP_PATH}/mdX"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# bootwait SSH/Web
|
||||
function _bootwait() {
|
||||
@@ -599,13 +609,13 @@ function _bootwait() {
|
||||
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
|
||||
MSG=""
|
||||
while test ${BOOTWAIT} -ge 0; do
|
||||
MSG="\033[1;33mAccess SSH/Web will interrupt boot...\033[0m"
|
||||
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
|
||||
if ! diff WB WC >/dev/null 2>&1; then
|
||||
echo -en "\r\033[1;33mAccess SSH/Web detected and boot is interrupted.\033[0m\n"
|
||||
echo -en "\r\033[1;33mAccess to SSH/Web detected and boot is interrupted.\033[0m\n"
|
||||
rm -f WB WC
|
||||
exit 0
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
BOOTWAIT=$((BOOTWAIT - 1))
|
||||
@@ -613,4 +623,15 @@ function _bootwait() {
|
||||
rm -f WB WC
|
||||
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# check and fix the DSM root partition
|
||||
# 1 - DSM root path
|
||||
function fixDSMRootPart() {
|
||||
if mdadm --detail "${1}" 2>/dev/null | grep -i "State" | grep -iEq "active|FAILED|Not Started"; then
|
||||
mdadm --stop "${1}" >/dev/null 2>&1
|
||||
mdadm --assemble --scan >/dev/null 2>&1
|
||||
fsck "${1}" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
@@ -1,3 +1,37 @@
|
||||
###############################################################################
|
||||
# Unpack modules from a tgz file
|
||||
# 1 - Platform
|
||||
# 2 - Kernel Version
|
||||
function unpackModules() {
|
||||
local PLATFORM=${1}
|
||||
local KVER=${2}
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Packag modules to a tgz file
|
||||
# 1 - Platform
|
||||
# 2 - Kernel Version
|
||||
function packModules() {
|
||||
local PLATFORM=${1}
|
||||
local KVER=${2}
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
else
|
||||
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Return list of all modules available
|
||||
# 1 - Platform
|
||||
@@ -10,15 +44,9 @@ function getAllModules() {
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
# Unzip modules for temporary folder
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
fi
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
# Get list of all modules
|
||||
for F in $(ls ${TMP_PATH}/modules/*.ko 2>/dev/null); do
|
||||
local X=$(basename ${F})
|
||||
@@ -45,34 +73,24 @@ function installModules() {
|
||||
echo "ERROR: installModules: Platform or Kernel Version not defined" >"${LOG_FILE}"
|
||||
return 1
|
||||
fi
|
||||
# Unzip modules for temporary folder
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
local ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
|
||||
for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do
|
||||
local M=$(basename ${F})
|
||||
[ "${ODP}" = "true" -a -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
|
||||
[ "${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}" 2>"${LOG_FILE}"
|
||||
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}"
|
||||
else
|
||||
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
|
||||
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}"
|
||||
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" 2>"${LOG_FILE}"
|
||||
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
|
||||
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
@@ -97,21 +115,12 @@ function addToModules() {
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
# Unzip modules for temporary folder
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
fi
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
cp -f ${KOFILE} ${TMP_PATH}/modules
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
else
|
||||
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
fi
|
||||
|
||||
packModules "${PLATFORM}" "${KVER}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -128,21 +137,12 @@ function delToModules() {
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
# Unzip modules for temporary folder
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
fi
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
rm -f ${TMP_PATH}/modules/${KONAME}
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
else
|
||||
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
|
||||
fi
|
||||
|
||||
packModules "${PLATFORM}" "${KVER}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@@ -170,15 +170,9 @@ function getdepends() {
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
# Unzip modules for temporary folder
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
mkdir -p "${TMP_PATH}/modules"
|
||||
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" = "custom" ]; then
|
||||
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
else
|
||||
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
|
||||
fi
|
||||
|
||||
unpackModules "${PLATFORM}" "${KVER}"
|
||||
|
||||
local DPS=($(_getdepends ${KONAME} | tr ' ' '\n' | sort -u))
|
||||
echo ${DPS[@]}
|
||||
rm -rf "${TMP_PATH}/modules"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Get Network Config for Loader
|
||||
function getnet() {
|
||||
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
@@ -21,16 +21,16 @@ function getnet() {
|
||||
# User Mac
|
||||
for N in ${ETHX}; do
|
||||
while true; do
|
||||
MAC="$(cat /sys/class/net/${N}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
|
||||
--inputbox "Type a custom MAC for ${ETH} (Eq. 001132abc123)." 7 50 "${MAC}"\
|
||||
--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' | tr '[:lower:]' '[:upper:]')"
|
||||
MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')"
|
||||
[ -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}"
|
||||
break
|
||||
else
|
||||
@@ -42,9 +42,9 @@ function getnet() {
|
||||
}
|
||||
|
||||
# Get Amount of NIC
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
# Get actual IP
|
||||
for ETH in ${ETHX}; do
|
||||
IPCON=$(getIP ${ETH})
|
||||
for N in ${ETHX}; do
|
||||
IPCON="$(getIP "${N}")"
|
||||
[ -n "${IPCON}" ] && break
|
||||
done
|
||||
@@ -2,53 +2,51 @@
|
||||
function getmap() {
|
||||
# Sata Disks
|
||||
SATADRIVES=0
|
||||
# Clean old files
|
||||
[ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax"
|
||||
touch "${TMP_PATH}/drivesmax"
|
||||
[ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon"
|
||||
touch "${TMP_PATH}/drivescon"
|
||||
[ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports"
|
||||
touch "${TMP_PATH}/ports"
|
||||
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap"
|
||||
touch "${TMP_PATH}/remap"
|
||||
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
|
||||
let DISKIDXMAPIDX=0
|
||||
DISKIDXMAP=""
|
||||
let DISKIDXMAPIDXMAX=0
|
||||
DISKIDXMAPMAX=""
|
||||
for PCI in $(lspci -d ::106 | 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}))
|
||||
done
|
||||
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}))
|
||||
done
|
||||
fi
|
||||
fi
|
||||
# SAS Disks
|
||||
SASDRIVES=0
|
||||
if [ $(lspci -d ::107 | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::107 | awk '{print $1}'); do
|
||||
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)
|
||||
@@ -57,8 +55,8 @@ function getmap() {
|
||||
fi
|
||||
# SCSI Disks
|
||||
SCSIDRIVES=0
|
||||
if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::100 | awk '{print $1}'); do
|
||||
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)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
@@ -67,8 +65,8 @@ function getmap() {
|
||||
fi
|
||||
# Raid Disks
|
||||
RAIDDRIVES=0
|
||||
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::104 | awk '{print $1}'); do
|
||||
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)
|
||||
@@ -77,8 +75,8 @@ function getmap() {
|
||||
fi
|
||||
# USB Disks
|
||||
USBDRIVES=0
|
||||
if [[ -d "/sys/class/scsi_host" && $(ls -l /sys/class/scsi_host | grep usb | wc -l) -gt 0 ]]; then
|
||||
for PCI in $(lspci -d ::c03 | awk '{print $1}'); do
|
||||
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)
|
||||
@@ -88,9 +86,9 @@ function getmap() {
|
||||
fi
|
||||
# MMC Disks
|
||||
MMCDRIVES=0
|
||||
if [[ -d "/sys/class/mmc_host" && $(ls -l /sys/class/mmc_host | grep mmc_host | wc -l) -gt 0 ]]; then
|
||||
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}" | sed "s/\ .*://")
|
||||
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}))
|
||||
@@ -98,8 +96,8 @@ function getmap() {
|
||||
fi
|
||||
# NVMe Disks
|
||||
NVMEDRIVES=0
|
||||
if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then
|
||||
for PCI in $(lspci -d ::108 | awk '{print $1}'); do
|
||||
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)
|
||||
@@ -119,7 +117,7 @@ function getmap() {
|
||||
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
|
||||
# Check for Sata Boot
|
||||
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
|
||||
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
|
||||
@@ -230,22 +228,22 @@ function getmapSelection() {
|
||||
}
|
||||
|
||||
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
|
||||
SATACONTROLLER=$(lspci -d ::106 | wc -l)
|
||||
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 | wc -l)
|
||||
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 | wc -l)
|
||||
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 | wc -l)
|
||||
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}"
|
||||
|
||||
@@ -26,27 +26,44 @@ function updateLoader() {
|
||||
export URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/update.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/update.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--gauge "Download Loader: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Update: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Updating Loader..." 3 50
|
||||
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; then
|
||||
HASHURL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.hash"
|
||||
HASH="$(curl -skL "${HASHURL}" | awk '{print $1}')"
|
||||
if [ "${HASH}" != "$(sha256sum "${TMP_PATH}/update.zip" | awk '{print $1}')" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update failed - Hash mismatch!\nTry again later." 0 0
|
||||
sleep 3
|
||||
exec reboot
|
||||
else
|
||||
rm -rf "/mnt/update"
|
||||
mkdir -p "${TMP_PATH}/update"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Updating Loader..." 3 50
|
||||
if unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}/update"; then
|
||||
cp -rf "${TMP_PATH}/update"/* "/mnt"
|
||||
rm -rf "${TMP_PATH}/update"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
fi
|
||||
fi
|
||||
if [ "$(cat "${PART1_PATH}/ARC-VERSION")" = "${TAG}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Update Loader successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
if [ "${ARCMODE}" = "update" ]; then
|
||||
@@ -72,16 +89,16 @@ function updateLoader() {
|
||||
[ -n "${ARCCONF}" ] && cp -f "${TMP_PATH}/bak.yml" "${S_FILE}"
|
||||
if [ "${ARCMODE}" = "update" ] && [ "${CONFDONE}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update successful! -> Reboot to automated Build Mode..." 3 60
|
||||
--infobox "Update Loader successful! -> Reboot to automated Build Mode..." 3 60
|
||||
sleep 3
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
rebootTo "automated"
|
||||
rebootTo automated
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update successful! -> Reboot to Config Mode..." 3 50
|
||||
--infobox "Update Loader successful! -> Reboot to Config Mode..." 3 50
|
||||
sleep 3
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
rebootTo "config"
|
||||
rebootTo config
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -102,21 +119,22 @@ function updateAddons() {
|
||||
export URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/addons.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/addons.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Addons" \
|
||||
--gauge "Download Addons: $TAG ..." 14 72
|
||||
}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Addons: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/addons.zip" ]; then
|
||||
rm -rf "${ADDONS_PATH}"
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
@@ -132,7 +150,7 @@ function updateAddons() {
|
||||
rm -f "${F}"
|
||||
done
|
||||
dialog --backtitle "$(backtitle)" --title "Update Addons" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update Addons successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
return 1
|
||||
@@ -161,21 +179,22 @@ function updatePatches() {
|
||||
export URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/patches.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/patches.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Patches" \
|
||||
--gauge "Download Patches: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Patches: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/patches.zip" ]; then
|
||||
rm -rf "${PATCH_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
@@ -184,7 +203,7 @@ function updatePatches() {
|
||||
if unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"; then
|
||||
rm -f "${TMP_PATH}/patches.zip"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Patches" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update Patches successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
return 1
|
||||
@@ -213,21 +232,22 @@ function updateCustom() {
|
||||
export URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/custom.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/custom.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
|
||||
--gauge "Download Custom Kernel: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Custom: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/custom.zip" ]; then
|
||||
rm -rf "${CUSTOM_PATH}"
|
||||
mkdir -p "${CUSTOM_PATH}"
|
||||
@@ -236,7 +256,7 @@ function updateCustom() {
|
||||
if unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"; then
|
||||
rm -f "${TMP_PATH}/custom.zip"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update Custom successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
return 1
|
||||
@@ -271,28 +291,29 @@ function updateModules() {
|
||||
export URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/modules.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/modules.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||
--gauge "Download Modules: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Modules: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/modules.zip" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||
--infobox "Updating Modules..." 3 50
|
||||
if unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"; then
|
||||
rm -f "${TMP_PATH}/modules.zip"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update Modules successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
return 1
|
||||
@@ -338,21 +359,22 @@ function updateConfigs() {
|
||||
export URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/configs.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/configs.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update Configs" \
|
||||
--gauge "Download Configs: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download Configs: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/configs.zip" ]; then
|
||||
mkdir -p "${MODEL_CONFIG_PATH}"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Configs" \
|
||||
@@ -360,7 +382,7 @@ function updateConfigs() {
|
||||
if unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"; then
|
||||
rm -f "${TMP_PATH}/configs.zip"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Configs" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update Configs successful!" 3 50
|
||||
sleep 2
|
||||
[ -n "${USERID}" ] && checkHardwareID || true
|
||||
else
|
||||
@@ -394,21 +416,22 @@ function updateLKMs() {
|
||||
export URL="https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip"
|
||||
export TAG="${TAG}"
|
||||
{
|
||||
curl -kL "$URL" -o ${TMP_PATH}/rp-lkms.zip 2>&1 |
|
||||
{
|
||||
curl -kL "${URL}" -o ${TMP_PATH}/rp-lkms.zip 2>&3 3>&-
|
||||
} 3>&1 >&4 4>&- |
|
||||
perl -C -lane '
|
||||
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
|
||||
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
|
||||
$pcent = $F[0];
|
||||
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
|
||||
s/ /\xa0/g;
|
||||
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
|
||||
if ($. <= 3) {
|
||||
$header .= "$_\n";
|
||||
$/ = "\r" if $. = 2
|
||||
$/ = "\r" if $. == 2
|
||||
} else {
|
||||
print "XXX\n$pcent\n$header$_\nXXX"
|
||||
}' |
|
||||
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
|
||||
--gauge "Download LKMs: $TAG ..." 14 72
|
||||
}
|
||||
}' 4>&- |
|
||||
dialog --gauge "Download LKMs: ${TAG}..." 14 72 4>&-
|
||||
} 4>&1
|
||||
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
|
||||
rm -rf "${LKMS_PATH}"
|
||||
mkdir -p "${LKMS_PATH}"
|
||||
@@ -417,7 +440,7 @@ function updateLKMs() {
|
||||
if unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"; then
|
||||
rm -f "${TMP_PATH}/rp-lkms.zip"
|
||||
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
|
||||
--infobox "Update successful!" 3 50
|
||||
--infobox "Update LKMs successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
return 1
|
||||
@@ -463,11 +486,11 @@ function dependenciesUpdate() {
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
if [ "${FAILED}" = "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update failed! Try again later." 3 40
|
||||
--infobox "Update Dependencies failed! Try again later." 3 40
|
||||
sleep 3
|
||||
elif [ "${FAILED}" = "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update successful!" 3 40
|
||||
--infobox "Update Dependencies successful!" 3 40
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 3
|
||||
|
||||
@@ -8,10 +8,12 @@ set -e
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
checkBootLoader || die "The loader is corrupted, please rewrite it!"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
|
||||
[ -f "${HOME}/.initialized" ] && exec arc.sh || true
|
||||
[ -f "${USER_CONFIG_FILE}" ] && sed -i "s/'/\"/g" "${USER_CONFIG_FILE}" >/dev/null 2>&1 || true
|
||||
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
|
||||
|
||||
# Print Title centralized
|
||||
clear
|
||||
@@ -40,11 +42,15 @@ initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "boot" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "boot.dsminfo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "boot.systeminfo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "boot.dsmlogo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen.dsminfo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen.systeminfo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen.diskinfo" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen.hwidinfo" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootscreen.dsmlogo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootipwait" "30" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "directboot" "false" "${USER_CONFIG_FILE}"
|
||||
@@ -95,27 +101,27 @@ if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}");
|
||||
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
# Read/Write IP/Mac to config
|
||||
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
ip addr flush dev ${N}
|
||||
ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${N}
|
||||
if [ -n "${IPRA[2]}" ]; then
|
||||
ip route add default via ${IPRA[2]} dev ${N}
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
for N in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
ip addr flush dev "${N}"
|
||||
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
|
||||
if [ -n "${IPRA[2]}" ]; then
|
||||
ip route add default via "${IPRA[2]}" dev "${N}"
|
||||
fi
|
||||
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
|
||||
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
|
||||
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
|
||||
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
|
||||
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
[ "${N::3}" = "eth" ] && ethtool -s ${N} wol g 2>/dev/null || true
|
||||
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
|
||||
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
|
||||
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
|
||||
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
ETHN=$(echo ${ETHX} | wc -w)
|
||||
writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
|
||||
# No network devices
|
||||
@@ -154,11 +160,7 @@ elif [ "${ARCMODE}" = "update" ]; then
|
||||
echo -e "\033[1;34mStarting Update Mode...\033[0m"
|
||||
elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then
|
||||
echo -e "\033[1;34mStarting DSM Mode...\033[0m"
|
||||
if [ -f "${ARC_PATH}/boot.sh" ]; then
|
||||
exec boot.sh && exit 0
|
||||
else
|
||||
echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m"
|
||||
fi
|
||||
exec boot.sh && exit 0
|
||||
else
|
||||
echo -e "\033[1;34mStarting Config Mode...\033[0m"
|
||||
fi
|
||||
@@ -179,8 +181,8 @@ for N in ${ETHX}; do
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 1))
|
||||
IP="$(getIP ${N})"
|
||||
COUNT=$((COUNT + 1))
|
||||
IP="$(getIP "${N}")"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
@@ -212,17 +214,19 @@ mkdir -p "${MODULES_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
mkdir -p "${USER_UP_PATH}"
|
||||
|
||||
# Tell webterminal that the loader is ready
|
||||
touch "${HOME}/.initialized"
|
||||
|
||||
# Load Arc Overlay
|
||||
echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
|
||||
echo
|
||||
echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m to configure Loader."
|
||||
echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m to configure Loader."
|
||||
|
||||
# Check memory and load Arc
|
||||
RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null)
|
||||
if [ ${RAM} -le 3500 ]; then
|
||||
echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m"
|
||||
else
|
||||
arc.sh
|
||||
exec arc.sh
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Binary file not shown.
@@ -93,21 +93,21 @@ while IFS=': ' read -r KEY VALUE; do
|
||||
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
|
||||
PATCHES=()
|
||||
PATCHES+=("ramdisk-etc-rc-*.patch")
|
||||
PATCHES+=("ramdisk-init-script-*.patch")
|
||||
PATCHES+=("ramdisk-post-init-script-*.patch")
|
||||
PATCHES+=("ramdisk-disable-root-pwd-*.patch")
|
||||
PATCHES+=("ramdisk-disable-disabled-ports-*.patch")
|
||||
for PE in ${PATCHES[@]}; do
|
||||
PATCHS=(
|
||||
"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}"
|
||||
(
|
||||
cd "${RAMDISK_PATH}"
|
||||
busybox patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1 # busybox patch and gun patch have different processing methods and parameters.
|
||||
)
|
||||
# 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
|
||||
@@ -128,13 +128,17 @@ done
|
||||
grep -v -e '^[\t ]*#' -e '^$' "${PATCH_PATH}/config-manipulators.sh" >"${TMP_PATH}/rp.txt"
|
||||
sed -e "/@@@CONFIG-MANIPULATORS-TOOLS@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
|
||||
rm -f "${TMP_PATH}/rp.txt"
|
||||
touch "${TMP_PATH}/rp.txt"
|
||||
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
|
||||
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc.defaults/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc.defaults/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
|
||||
done
|
||||
|
||||
# Generate synoinfo configurations
|
||||
{
|
||||
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc/synoinfo.conf'"
|
||||
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc.defaults/synoinfo.conf'"
|
||||
for KEY in "${!SYNOINFO[@]}"; do
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc/synoinfo.conf'"
|
||||
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc.defaults/synoinfo.conf'"
|
||||
done
|
||||
} >"${TMP_PATH}/rp.txt"
|
||||
|
||||
sed -e "/@@@CONFIG-GENERATED@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
|
||||
rm -f "${TMP_PATH}/rp.txt"
|
||||
|
||||
@@ -149,20 +153,22 @@ gzip -dc "${LKMS_PATH}/rp-${PLATFORM}-${KVERP}-${LKM}.ko.gz" >"${RAMDISK_PATH}/u
|
||||
# Addons
|
||||
echo "Create addons.sh" >"${LOG_FILE}"
|
||||
mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo "#!/bin/sh" >"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo 'echo "addons.sh called with params ${@}"' >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export LOADERLABEL=\"ARC\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export LOADERVERSION=\"${ARC_VERSION}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export LOADERBUILD=\"${ARC_BUILD}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export LOADERBRANCH=\"${ARCBRANCH}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export PLATFORM=\"${PLATFORM}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export PRODUCTVER=\"${PRODUCTVER}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export MODEL=\"${MODEL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export MODELID=\"${MODELID}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export MLINK=\"${PAT_URL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export MCHECKSUM=\"${PAT_HASH}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export LAYOUT=\"${LAYOUT}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export KEYMAP=\"${KEYMAP}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
{
|
||||
echo "#!/bin/sh"
|
||||
echo 'echo "addons.sh called with params ${@}"'
|
||||
echo "export LOADERLABEL=\"ARC\""
|
||||
echo "export LOADERVERSION=\"${ARC_VERSION}\""
|
||||
echo "export LOADERBUILD=\"${ARC_BUILD}\""
|
||||
echo "export LOADERBRANCH=\"${ARCBRANCH}\""
|
||||
echo "export PLATFORM=\"${PLATFORM}\""
|
||||
echo "export MODEL=\"${MODEL}\""
|
||||
echo "export MODELID=\"${MODELID}\""
|
||||
echo "export PRODUCTVER=\"${PRODUCTVER}\""
|
||||
echo "export MLINK=\"${PAT_URL}\""
|
||||
echo "export MCHECKSUM=\"${PAT_HASH}\""
|
||||
echo "export LAYOUT=\"${LAYOUT:-qwerty}\""
|
||||
echo "export KEYMAP=\"${KEYMAP:-en}\""
|
||||
} >"${RAMDISK_PATH}/addons/addons.sh"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# System Addons
|
||||
|
||||
@@ -3,72 +3,89 @@
|
||||
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
calculate_run_size() {
|
||||
NUM='\([0-9a-fA-F]*[ \t]*\)'
|
||||
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/0x\1 0x\4/p')
|
||||
|
||||
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
if [ -z "${OUT}" ]; then
|
||||
echo "Never found .bss or .brk file offset" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
read -r sizeA offsetA sizeB offsetB <<<$(echo ${OUT} | awk '{printf "%d %d %d %d", strtonum($1), strtonum($2), strtonum($3), strtonum($4)}')
|
||||
|
||||
runSize=$((offsetA + sizeA + sizeB))
|
||||
|
||||
# BFD linker shows the same file offset in ELF.
|
||||
if [ "${offsetA}" -ne "${offsetB}" ]; then
|
||||
# Gold linker shows them as consecutive.
|
||||
endSize=$((offsetB + sizeB))
|
||||
if [ "${endSize}" -ne "${runSize}" ]; then
|
||||
printf "sizeA: 0x%x\n" ${sizeA} >&2
|
||||
printf "offsetA: 0x%x\n" ${offsetA} >&2
|
||||
printf "sizeB: 0x%x\n" ${sizeB} >&2
|
||||
printf "offsetB: 0x%x\n" ${offsetB} >&2
|
||||
echo ".bss and .brk are non-contiguous" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "%d\n" ${runSize}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Adapted from: scripts/Makefile.lib
|
||||
# Usage: size_append FILE [FILE2] [FILEn]...
|
||||
# Output: LE HEX with size of file in bytes (to STDOUT)
|
||||
file_size_le() {
|
||||
printf $(
|
||||
dec_size=0
|
||||
for F in "${@}"; do
|
||||
fsize=$(stat -c "%s" ${F})
|
||||
dec_size=$((${dec_size} + ${fsize}))
|
||||
done
|
||||
printf "%08x\n" ${dec_size} |
|
||||
sed 's/\(..\)/\1 /g' | {
|
||||
read ch0 ch1 ch2 ch3
|
||||
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
|
||||
printf '%s%03o' '\' $((0x${ch}))
|
||||
done
|
||||
local dec_size=0
|
||||
for F in "$@"; do dec_size=$((dec_size + $(stat -c "%s" "${F}"))); done
|
||||
printf "%08x\n" "${dec_size}" | sed 's/\(..\)/\1 /g' | {
|
||||
read -r ch0 ch1 ch2 ch3
|
||||
for ch in "${ch3}" "${ch2}" "${ch1}" "${ch0}"; do printf '%s%03o' '\' "$((0x${ch}))"; done
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
size_le() {
|
||||
printf $(
|
||||
printf "%08x\n" "${@}" |
|
||||
sed 's/\(..\)/\1 /g' | {
|
||||
read ch0 ch1 ch2 ch3
|
||||
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
|
||||
printf '%s%03o' '\' $((0x${ch}))
|
||||
done
|
||||
printf "%08x\n" "${@}" | sed 's/\(..\)/\1 /g' | {
|
||||
read -r ch0 ch1 ch2 ch3
|
||||
for ch in "${ch3}" "${ch2}" "${ch1}" "${ch0}"; do printf '%s%03o' '\' "$((0x${ch}))"; done
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
VMLINUX_MOD=${1}
|
||||
ZIMAGE_MOD=${2}
|
||||
KVER_MAJOR=${KVER:0:1}
|
||||
if [ ${KVER_MAJOR} -eq 4 ]; then
|
||||
|
||||
KVER=$(strings "${VMLINUX_MOD}" | grep -Eo "Linux version [0-9]+\.[0-9]+\.[0-9]+" | head -1 | awk '{print $3}')
|
||||
if [ "$(echo "${KVER:-4}" | cut -d'.' -f1)" -lt 5 ]; then
|
||||
# Kernel version 4.x or 3.x (bromolow)
|
||||
#zImage_head 16494
|
||||
#payload(
|
||||
# vmlinux.bin x
|
||||
# padding 0xf00000-x
|
||||
# vmlinux.bin size 4
|
||||
#) 0xf00004
|
||||
#zImage_tail(
|
||||
# unknown 72
|
||||
# run_size 4
|
||||
# unknown 30
|
||||
# vmlinux.bin size 4
|
||||
# unknown 114460
|
||||
#) 114570
|
||||
#crc32 4
|
||||
# zImage_head 16494
|
||||
# payload(
|
||||
# vmlinux.bin x
|
||||
# padding 0xf00000-x
|
||||
# vmlinux.bin size 4
|
||||
# ) 0xf00004
|
||||
# zImage_tail(
|
||||
# unknown 72
|
||||
# run_size 4
|
||||
# unknown 30
|
||||
# vmlinux.bin size 4
|
||||
# unknown 114460
|
||||
# ) 114570
|
||||
# crc32 4
|
||||
gzip -dc "${ARC_PATH}/bzImage-template-v4.gz" >"${ZIMAGE_MOD}" || exit 1
|
||||
|
||||
dd if="${VMLINUX_MOD}" of="${ZIMAGE_MOD}" bs=16494 seek=1 conv=notrunc || exit 1
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745134 seek=1 conv=notrunc || exit 1
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745244 seek=1 conv=notrunc || exit 1
|
||||
|
||||
RUN_SIZE=$(objdump -h ${VMLINUX_MOD} | sh "${ARC_PATH}/calc_run_size.sh")
|
||||
size_le ${RUN_SIZE} | dd of=${ZIMAGE_MOD} bs=15745210 seek=1 conv=notrunc|| exit 1
|
||||
size_le $(($((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}'))) ^ 0xFFFFFFFF)) | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
|
||||
RUN_SIZE=$(objdump -h "${VMLINUX_MOD}" | calc_run_size)
|
||||
size_le "${RUN_SIZE}" | dd of="${ZIMAGE_MOD}" bs=15745210 seek=1 conv=notrunc || exit 1
|
||||
size_le "$((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}') ^ 0xFFFFFFFF))" | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
|
||||
else
|
||||
# Kernel version 5.x
|
||||
gzip -dc "${ARC_PATH}/bzImage-template-v5.gz" >"${ZIMAGE_MOD}" || exit 1
|
||||
@@ -76,7 +93,7 @@ else
|
||||
dd if="${VMLINUX_MOD}" of="${ZIMAGE_MOD}" bs=14561 seek=1 conv=notrunc || exit 1
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=34463421 seek=1 conv=notrunc || exit 1
|
||||
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=34479132 seek=1 conv=notrunc || exit 1
|
||||
# RUN_SIZE=$(objdump -h ${VMLINUX_MOD} | sh "${ARC_PATH}/calc_run_size.sh")
|
||||
# size_le ${RUN_SIZE} | dd of=${ZIMAGE_MOD} bs=34626904 seek=1 conv=notrunc || exit 1
|
||||
size_le $(($((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}'))) ^ 0xFFFFFFFF)) | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
|
||||
# RUN_SIZE=$(objdump -h "${VMLINUX_MOD}" | calc_run_size)
|
||||
# size_le "${RUN_SIZE}" | dd of="${ZIMAGE_MOD}" bs=34626904 seek=1 conv=notrunc || exit 1
|
||||
size_le "$((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}') ^ 0xFFFFFFFF))" | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
|
||||
fi
|
||||
@@ -1,27 +1,13 @@
|
||||
insmod search
|
||||
insmod echo
|
||||
insmod terminal
|
||||
insmod test
|
||||
insmod font
|
||||
insmod loadenv
|
||||
insmod serial
|
||||
insmod usb_keyboard
|
||||
insmod linux
|
||||
insmod gzio
|
||||
insmod fat
|
||||
insmod ext2
|
||||
insmod ata
|
||||
insmod btrfs
|
||||
insmod part_msdos
|
||||
insmod part_gpt
|
||||
|
||||
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
|
||||
if [ -s ${prefix}/grubenv ]; then
|
||||
load_env --skip-sig
|
||||
fi
|
||||
if [ "${next_entry}" ]; then
|
||||
set default="${next_entry}"
|
||||
@@ -32,26 +18,29 @@ if [ "${vesa_mode}" ]; then
|
||||
set vesa_mode=${vesa_mode}
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
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
|
||||
fi
|
||||
|
||||
load_video
|
||||
if loadfont unicode; then
|
||||
insmod gfxterm
|
||||
set gfxmode=1024x768
|
||||
set gfxpayload=auto
|
||||
terminal_output gfxterm
|
||||
if [ "${grub_platform}" = "efi" ]; then
|
||||
set gfxmode=auto
|
||||
terminal_output --append gfxterm
|
||||
else
|
||||
set gfxmode=1024x768
|
||||
terminal_output gfxterm
|
||||
fi
|
||||
insmod gfxmenu
|
||||
loadfont ${prefix}/theme/dejavu_bold_14.pf2
|
||||
loadfont ${prefix}/theme/dejavu_mono_12.pf2
|
||||
@@ -60,9 +49,9 @@ if loadfont unicode; then
|
||||
export theme
|
||||
fi
|
||||
|
||||
if serial --unit=0 --speed=115200; then
|
||||
terminal_input --append serial_com0
|
||||
terminal_output --append serial_com0
|
||||
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 {
|
||||
@@ -73,11 +62,7 @@ function set_gfxpayload {
|
||||
fi
|
||||
}
|
||||
|
||||
set menu_color_normal=white/black
|
||||
set menu_color_highlight=white/red
|
||||
set color_normal=white/black
|
||||
|
||||
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait nointremap net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable"
|
||||
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"
|
||||
|
||||
search --set=root --label "ARC3"
|
||||
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
|
||||
@@ -183,6 +168,11 @@ menuentry 'Start Memtest86+' --id memtest {
|
||||
linux ${prefix}/memtest
|
||||
}
|
||||
|
||||
menuentry 'Poweroff' --id poweroff {
|
||||
echo "System is powering off..."
|
||||
halt
|
||||
}
|
||||
|
||||
if [ ${vesa_mode} = 1 ]; then
|
||||
menuentry 'Change Vesa to Text Output' --id videomode {
|
||||
set vesa_mode=0
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20
img-gen-n.sh
20
img-gen-n.sh
@@ -7,6 +7,10 @@ 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"
|
||||
@@ -37,16 +41,20 @@ sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="13.37.dev"
|
||||
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"
|
||||
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
|
||||
[[ ! -f "brx/bzImage-arc" || ! -f "brx/initrd-arc" ]] && exit 1
|
||||
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
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"
|
||||
@@ -56,8 +64,8 @@ sync
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
rmdir "/tmp/p1"
|
||||
rmdir "/tmp/p3"
|
||||
sudo rm -rf "/tmp/p1"
|
||||
sudo rm -rf "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
|
||||
20
img-gen-s.sh
20
img-gen-s.sh
@@ -7,6 +7,10 @@ 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"
|
||||
@@ -36,16 +40,20 @@ sudo mount ${LOOPX}p1 "/tmp/p1"
|
||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
||||
|
||||
ARC_BUILD="`date +'%y%m%d'`"
|
||||
ARC_VERSION="13.37.dev"
|
||||
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
|
||||
|
||||
echo "Repack initrd"
|
||||
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
|
||||
[[ ! -f "brs/bzImage-arc" || ! -f "brs/initrd-arc" ]] && exit 1
|
||||
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
|
||||
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"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Copying files"
|
||||
sudo cp -rf "files/p1/"* "/tmp/p1"
|
||||
@@ -55,8 +63,8 @@ sync
|
||||
echo "Unmount image file"
|
||||
sudo umount "/tmp/p1"
|
||||
sudo umount "/tmp/p3"
|
||||
rmdir "/tmp/p1"
|
||||
rmdir "/tmp/p3"
|
||||
sudo rm -rf "/tmp/p1"
|
||||
sudo rm -rf "/tmp/p3"
|
||||
|
||||
sudo losetup --detach ${LOOPX}
|
||||
|
||||
|
||||
BIN
kpatch/kpatch
BIN
kpatch/kpatch
Binary file not shown.
@@ -489,4 +489,4 @@ int main(int argc, char *argv[])
|
||||
close(fd);
|
||||
printf("Finish!\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
415
scripts/func.sh
415
scripts/func.sh
@@ -15,19 +15,21 @@ function getLKMs() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/rp-lkms.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export LKMTAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip LKMs
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting LKMs end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get LKMs"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "rp-lkms.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip LKMs
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting LKMs end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Addons
|
||||
@@ -37,28 +39,31 @@ function getAddons() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_DIR="/tmp/addons"
|
||||
local CACHE_FILE="/tmp/addons.zip"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export ADDONTAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Addons
|
||||
rm -rf "${CACHE_DIR}"
|
||||
mkdir -p "${CACHE_DIR}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}"
|
||||
echo "Installing Addons to ${DEST_PATH}"
|
||||
[ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/
|
||||
for PKG in $(ls ${CACHE_DIR}/*.addon); do
|
||||
ADDON=$(basename "${PKG}" .addon)
|
||||
mkdir -p "${DEST_PATH}/${ADDON}"
|
||||
echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}"
|
||||
tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}"
|
||||
done
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Addons end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Addons"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "addons-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Addons
|
||||
rm -rf "${CACHE_DIR}"
|
||||
mkdir -p "${CACHE_DIR}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}"; then
|
||||
echo "Installing Addons to ${DEST_PATH}"
|
||||
[ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/
|
||||
for PKG in $(ls ${CACHE_DIR}/*.addon); do
|
||||
ADDON=$(basename "${PKG}" .addon)
|
||||
mkdir -p "${DEST_PATH}/${ADDON}"
|
||||
echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}"
|
||||
tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}"
|
||||
done
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Addons end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Modules
|
||||
@@ -68,18 +73,21 @@ function getModules() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/modules.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export MODULETAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Modules
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
echo "Getting Modules end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Modules"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "modules-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Modules
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Modules end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Configs
|
||||
@@ -89,19 +97,21 @@ function getConfigs() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/configs.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export CONFIGTAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Configs
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Configs end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Configs"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "configs-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Configs
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Configs end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Patches
|
||||
@@ -111,19 +121,21 @@ function getPatches() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/patches.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export PATCHTAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Patches
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Patches end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Patches"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "patches-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Patches
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Patches end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Custom
|
||||
@@ -133,19 +145,21 @@ function getCustom() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/custom.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export CUSTOMTAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Custom
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Custom end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Custom"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "custom-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Custom
|
||||
rm -rf "${DEST_PATH}"
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Custom end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Theme
|
||||
@@ -155,23 +169,25 @@ function getTheme() {
|
||||
local DEST_PATH="${1}"
|
||||
local CACHE_FILE="/tmp/theme.zip"
|
||||
rm -f "${CACHE_FILE}"
|
||||
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
|
||||
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
|
||||
export THEMETAG="${TAG}"
|
||||
if curl -skL "https://github.com/AuxXxilium/arc-theme/releases/download/${TAG}/arc-theme-${TAG}.zip" -o "${CACHE_FILE}"; then
|
||||
# Unzip Theme
|
||||
mkdir -p "${DEST_PATH}"
|
||||
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Theme end - ${TAG}"
|
||||
else
|
||||
echo "Failed to get Theme"
|
||||
exit 1
|
||||
fi
|
||||
while read -r ID NAME; do
|
||||
if [ "${NAME}" = "arc-theme-${TAG}.zip" ]; then
|
||||
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/assets/${ID}" -o "${CACHE_FILE}"
|
||||
# Unzip Theme
|
||||
mkdir -p "${DEST_PATH}"
|
||||
if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then
|
||||
rm -f "${CACHE_FILE}"
|
||||
echo "Getting Theme end - ${TAG}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
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 getBuildroots() {
|
||||
function getBuildrootx() {
|
||||
echo "Getting Buildroot-X begin"
|
||||
local DEST_PATH="${1}"
|
||||
|
||||
@@ -183,13 +199,13 @@ function getBuildroots() {
|
||||
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: ${TAG}"
|
||||
echo "Buildroot-X: ${TAG}"
|
||||
unzip -o "${DEST_PATH}/brx.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)"')
|
||||
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
|
||||
@@ -206,13 +222,13 @@ function getBuildroots() {
|
||||
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: ${TAG}"
|
||||
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/arc-buildroot-s/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
|
||||
}
|
||||
|
||||
# Get latest Offline
|
||||
@@ -232,52 +248,49 @@ function getOffline() {
|
||||
}
|
||||
|
||||
# repack initrd
|
||||
# $1 initrd file
|
||||
# $1 initrd file
|
||||
# $2 plugin path
|
||||
# $3 output file
|
||||
function repackInitrd() {
|
||||
INITRD_FILE="${1}"
|
||||
PLUGIN_PATH="${2}"
|
||||
OUTPUT_PATH="${3:-${INITRD_FILE}}"
|
||||
local INITRD_FILE="${1}"
|
||||
local PLUGIN_PATH="${2}"
|
||||
local OUTPUT_PATH="${3:-${INITRD_FILE}}"
|
||||
|
||||
[ -z "${INITRD_FILE}" ] || [ ! -f "${INITRD_FILE}" ] && exit 1
|
||||
[ -z "${PLUGIN_PATH}" ] || [ ! -d "${PLUGIN_PATH}" ] && exit 1
|
||||
|
||||
INITRD_FILE="$(readlink -f "${INITRD_FILE}")"
|
||||
PLUGIN_PATH="$(readlink -f "${PLUGIN_PATH}")"
|
||||
OUTPUT_PATH="$(readlink -f "${OUTPUT_PATH}")"
|
||||
|
||||
RDXZ_PATH="rdxz_tmp"
|
||||
INITRD_FILE="$(realpath "${INITRD_FILE}")"
|
||||
PLUGIN_PATH="$(realpath "${PLUGIN_PATH}")"
|
||||
OUTPUT_PATH="$(realpath "${OUTPUT_PATH}")"
|
||||
|
||||
local RDXZ_PATH="rdxz_tmp"
|
||||
mkdir -p "${RDXZ_PATH}"
|
||||
local INITRD_FORMAT=$(file -b --mime-type "${INITRD_FILE}")
|
||||
(
|
||||
cd "${RDXZ_PATH}"
|
||||
case "${INITRD_FORMAT}" in
|
||||
*'x-cpio'*) sudo cpio -idm <"${INITRD_FILE}" ;;
|
||||
*'x-xz'*) xz -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*'x-lz4'*) lz4 -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*'x-lzma'*) lzma -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*'x-bzip2'*) bzip2 -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*'gzip'*) gzip -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*'zstd'*) zstd -dc "${INITRD_FILE}" | sudo cpio -idm ;;
|
||||
*) ;;
|
||||
esac
|
||||
) || true
|
||||
|
||||
case "${INITRD_FORMAT}" in
|
||||
*'x-cpio'*) (cd "${RDXZ_PATH}" && sudo cpio -idm <"${INITRD_FILE}") >/dev/null 2>&1 ;;
|
||||
*'x-xz'*) (cd "${RDXZ_PATH}" && xz -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*'x-lz4'*) (cd "${RDXZ_PATH}" && lz4 -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*'x-lzma'*) (cd "${RDXZ_PATH}" && lzma -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*'x-bzip2'*) (cd "${RDXZ_PATH}" && bzip2 -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*'gzip'*) (cd "${RDXZ_PATH}" && gzip -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*'zstd'*) (cd "${RDXZ_PATH}" && zstd -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
sudo cp -rf "${PLUGIN_PATH}/"* "${RDXZ_PATH}/"
|
||||
[ -f "${OUTPUT_PATH}" ] && rm -rf "${OUTPUT_PATH}"
|
||||
(
|
||||
cd "${RDXZ_PATH}"
|
||||
case "${INITRD_FORMAT}" in
|
||||
*'x-cpio'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root >"${OUTPUT_PATH}" ;;
|
||||
*'x-xz'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 -C crc32 -c - >"${OUTPUT_PATH}" ;;
|
||||
*'x-lz4'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lz4 -9 -l -c - >"${OUTPUT_PATH}" ;;
|
||||
*'x-lzma'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lzma -9 -c - >"${OUTPUT_PATH}" ;;
|
||||
*'x-bzip2'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | bzip2 -9 -c - >"${OUTPUT_PATH}" ;;
|
||||
*'gzip'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | gzip -9 -c - >"${OUTPUT_PATH}" ;;
|
||||
*'zstd'*) sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | zstd -19 -T0 -f -c - >"${OUTPUT_PATH}" ;;
|
||||
*) ;;
|
||||
esac
|
||||
) || true
|
||||
|
||||
case "${INITRD_FORMAT}" in
|
||||
*'x-cpio'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'x-xz'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 -C crc32 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'x-lz4'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lz4 -9 -l -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'x-lzma'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lzma -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'x-bzip2'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | bzip2 -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'gzip'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | gzip -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*'zstd'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | zstd -19 -T0 -f -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
sudo rm -rf "${RDXZ_PATH}"
|
||||
}
|
||||
|
||||
@@ -293,8 +306,8 @@ function resizeImg() {
|
||||
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
|
||||
[ -z "${CHANGE_SIZE}" ] && exit 1
|
||||
|
||||
INPUT_FILE="$(readlink -f "${INPUT_FILE}")"
|
||||
OUTPUT_FILE="$(readlink -f "${OUTPUT_FILE}")"
|
||||
INPUT_FILE="$(realpath "${INPUT_FILE}")"
|
||||
OUTPUT_FILE="$(realpath "${OUTPUT_FILE}")"
|
||||
|
||||
|
||||
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
|
||||
@@ -313,47 +326,28 @@ function resizeImg() {
|
||||
sudo losetup -d ${LOOPX}
|
||||
}
|
||||
|
||||
# convertova
|
||||
# createvmx
|
||||
# $1 bootloader file
|
||||
# $2 ova file
|
||||
function convertova() {
|
||||
# $2 vmx name
|
||||
function createvmx() {
|
||||
BLIMAGE=${1}
|
||||
OVAPATH=${2}
|
||||
VMNAME=${2}
|
||||
|
||||
BLIMAGE="$(readlink -f "${BLIMAGE}")"
|
||||
OVAPATH="$(readlink -f "${OVAPATH}")"
|
||||
VMNAME="$(basename "${OVAPATH}" .ova)"
|
||||
|
||||
# Download and install ovftool if it doesn't exist
|
||||
if [ ! -x ovftool/ovftool ]; then
|
||||
rm -rf ovftool ovftool.zip
|
||||
curl -skL https://github.com/rgl/ovftool-binaries/raw/main/archive/VMware-ovftool-4.6.0-21452615-lin.x86_64.zip -o ovftool.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to download ovftool"
|
||||
exit 1
|
||||
fi
|
||||
unzip ovftool.zip -d . >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to extract ovftool"
|
||||
exit 1
|
||||
fi
|
||||
chmod +x ovftool/ovftool
|
||||
fi
|
||||
if ! command -v qemu-img &>/dev/null; then
|
||||
sudo apt install -y qemu-utils
|
||||
fi
|
||||
|
||||
# Convert raw image to VMDK
|
||||
rm -rf "OVA_${VMNAME}"
|
||||
mkdir -p "OVA_${VMNAME}"
|
||||
qemu-img convert -O vmdk -o 'adapter_type=lsilogic,subformat=streamOptimized,compat6' "${BLIMAGE}" "OVA_${VMNAME}/${VMNAME}-disk1.vmdk"
|
||||
qemu-img create -f vmdk "OVA_${VMNAME}/${VMNAME}-disk2.vmdk" "32G"
|
||||
rm -rf "VMX_${VMNAME}"
|
||||
mkdir -p "VMX_${VMNAME}"
|
||||
qemu-img convert -O vmdk -o 'adapter_type=lsilogic,subformat=streamOptimized,compat6' "${BLIMAGE}" "VMX_${VMNAME}/${VMNAME}-disk1.vmdk"
|
||||
qemu-img create -f vmdk "VMX_${VMNAME}/${VMNAME}-disk2.vmdk" "32G"
|
||||
|
||||
# Create VM configuration
|
||||
cat <<_EOF_ >"OVA_${VMNAME}/${VMNAME}.vmx"
|
||||
cat <<_EOF_ >"VMX_${VMNAME}/${VMNAME}.vmx"
|
||||
.encoding = "UTF-8"
|
||||
config.version = "8"
|
||||
virtualHW.version = "21"
|
||||
virtualHW.version = "17"
|
||||
displayName = "${VMNAME}"
|
||||
annotation = "https://github.com/AuxXxilium/arc"
|
||||
guestOS = "ubuntu-64"
|
||||
@@ -401,16 +395,101 @@ ethernet0.virtualDev = "vmxnet3"
|
||||
ethernet0.connectionType = "nat"
|
||||
ethernet0.allowguestconnectioncontrol = "true"
|
||||
ethernet0.present = "TRUE"
|
||||
serial0.fileType = "file"
|
||||
serial0.fileName = "serial0.log"
|
||||
serial0.present = "TRUE"
|
||||
sata0.present = "TRUE"
|
||||
sata0:0.fileName = "${VMNAME}-disk1.vmdk"
|
||||
sata0:0.present = "TRUE"
|
||||
sata0:1.fileName = "${VMNAME}-disk2.vmdk"
|
||||
sata0:1.present = "TRUE"
|
||||
_EOF_
|
||||
}
|
||||
|
||||
# convertvmx
|
||||
# $1 bootloader file
|
||||
# $2 vmx file
|
||||
function convertvmx() {
|
||||
local BLIMAGE=${1}
|
||||
local VMXPATH=${2}
|
||||
|
||||
BLIMAGE="$(realpath "${BLIMAGE}")"
|
||||
VMXPATH="$(realpath "${VMXPATH}")"
|
||||
local VMNAME="$(basename "${VMXPATH}" .vmx)"
|
||||
|
||||
createvmx "${BLIMAGE}" "${VMNAME}"
|
||||
|
||||
rm -rf "${VMXPATH}"
|
||||
mv -f "VMX_${VMNAME}" "${VMXPATH}"
|
||||
}
|
||||
|
||||
# convertova
|
||||
# $1 bootloader file
|
||||
# $2 ova file
|
||||
function convertova() {
|
||||
local BLIMAGE=${1}
|
||||
local OVAPATH=${2}
|
||||
|
||||
BLIMAGE="$(realpath "${BLIMAGE}")"
|
||||
OVAPATH="$(realpath "${OVAPATH}")"
|
||||
local VMNAME="$(basename "${OVAPATH}" .ova)"
|
||||
|
||||
createvmx "${BLIMAGE}" "${VMNAME}"
|
||||
|
||||
# Download and install ovftool if it doesn't exist
|
||||
if [ ! -x ovftool/ovftool ]; then
|
||||
rm -rf ovftool ovftool.zip
|
||||
curl -skL https://github.com/rgl/ovftool-binaries/raw/main/archive/VMware-ovftool-4.6.0-21452615-lin.x86_64.zip -o ovftool.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to download ovftool"
|
||||
exit 1
|
||||
fi
|
||||
unzip ovftool.zip -d . >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to extract ovftool"
|
||||
exit 1
|
||||
fi
|
||||
chmod +x ovftool/ovftool
|
||||
fi
|
||||
|
||||
rm -f "${OVAPATH}"
|
||||
ovftool/ovftool "OVA_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
|
||||
rm -rf "OVA_${VMNAME}"
|
||||
ovftool/ovftool "VMX_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
|
||||
rm -rf "VMX_${VMNAME}"
|
||||
}
|
||||
|
||||
# createvmc
|
||||
# $1 vhd file
|
||||
# $2 vmc file
|
||||
function createvmc() {
|
||||
local BLIMAGE=${1:-arc.vhd}
|
||||
local VMCPATH=${2:-arc.vmc}
|
||||
|
||||
BLIMAGE="$(basename "${BLIMAGE}")"
|
||||
VMCPATH="$(realpath "${VMCPATH}")"
|
||||
|
||||
cat <<_EOF_ >"${VMCPATH}"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<preferences>
|
||||
<version type="string">2.0</version>
|
||||
<hardware>
|
||||
<memory>
|
||||
<ram_size type="integer">4096</ram_size>
|
||||
</memory>
|
||||
<pci_bus>
|
||||
<ide_adapter>
|
||||
<ide_controller id="0">
|
||||
<location id="0">
|
||||
<drive_type type="integer">1</drive_type>
|
||||
<pathname>
|
||||
<relative type="string">${BLIMAGE}</relative>
|
||||
</pathname>
|
||||
</location>
|
||||
</ide_controller>
|
||||
</ide_adapter>
|
||||
</pci_bus>
|
||||
</hardware>
|
||||
</preferences>
|
||||
_EOF_
|
||||
}
|
||||
|
||||
# copy buildroot
|
||||
@@ -420,4 +499,12 @@ function copyBuildroot() {
|
||||
mkdir -p "${DEST_PATH}"
|
||||
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
|
||||
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
|
||||
}
|
||||
|
||||
# create arc executable
|
||||
function createArc() {
|
||||
[ ! -f "arc" ] && ./scripts/make/makeself.sh --current --zstd --quiet "../arc/files/initrd/opt/arc" arc "Arc Loader" "./init.sh" || true
|
||||
rm -rf "../arc/files/initrd/opt/arc"
|
||||
mkdir -p "../arc/files/initrd/opt/arc"
|
||||
cp -f "arc" "../arc/files/initrd/opt/arc/"
|
||||
}
|
||||
714
scripts/make/makeself-header.sh
Executable file
714
scripts/make/makeself-header.sh
Executable file
@@ -0,0 +1,714 @@
|
||||
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
|
||||
158
scripts/make/makeself.1
Normal file
158
scripts/make/makeself.1
Normal file
@@ -0,0 +1,158 @@
|
||||
.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).
|
||||
776
scripts/make/makeself.sh
Executable file
776
scripts/make/makeself.sh
Executable file
@@ -0,0 +1,776 @@
|
||||
#!/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