mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 13:40:51 +07:00
init: addons
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
8cecfe603b
commit
49991224b6
3
.github/FUNDING.yml
vendored
Executable file
3
.github/FUNDING.yml
vendored
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: AuxXxilium
|
104
.github/workflows/build.yml
vendored
Executable file
104
.github/workflows/build.yml
vendored
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Build Addons
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "format %y.%-m.$i or auto"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
prerelease:
|
||||||
|
description: "pre release"
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
clean:
|
||||||
|
description: "clean"
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Clean Old
|
||||||
|
if: inputs.clean == true
|
||||||
|
uses: Nats-ji/delete-old-releases@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
keep-count: 10
|
||||||
|
keep-old-minor-releases: false
|
||||||
|
|
||||||
|
- name: Changelog
|
||||||
|
uses: Bullrich/generate-release-changelog@master
|
||||||
|
id: Changelog
|
||||||
|
env:
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Init Env
|
||||||
|
run: |
|
||||||
|
git config --global user.email "info@auxxxilium.tech"
|
||||||
|
git config --global user.name "AuxXxilium"
|
||||||
|
sudo timedatectl set-timezone "Europe/Berlin"
|
||||||
|
|
||||||
|
- name: Calculate Version
|
||||||
|
run: |
|
||||||
|
# Calculate Version
|
||||||
|
VERSION=""
|
||||||
|
if [ -n "${{ inputs.version }}" ]; then
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
else
|
||||||
|
LATEST_TAG="$(curl -skL "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r ".tag_name" 2>/dev/null)"
|
||||||
|
if [[ -n "${LATEST_TAG}" && "`echo ${LATEST_TAG} | cut -d '.' -f 1,2`" = "`date +'%y.%-m.%-d'`" ]]; then # format %y.%-m.$i
|
||||||
|
VERSION="`echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.'`"
|
||||||
|
else
|
||||||
|
VERSION="`date +'%y.%-m.%-d'`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${VERSION}" ]; then
|
||||||
|
# Modify Source File
|
||||||
|
echo "Version: ${VERSION}"
|
||||||
|
echo "${VERSION}" >VERSION
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build Addon Packages
|
||||||
|
run: |
|
||||||
|
VERSION="${{ env.VERSION }}"
|
||||||
|
sed -i "s/version:.*$/version: ${VERSION}/g" */manifest.yml
|
||||||
|
./compile-addons.sh
|
||||||
|
zip -9 addons.zip -j *.addon VERSION
|
||||||
|
|
||||||
|
- name: Upload to Artifacts
|
||||||
|
if: success() && env.VERSION == ''
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: addons
|
||||||
|
path: |
|
||||||
|
addons.zip
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
if: success() && env.VERSION != ''
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
tag: ${{ env.VERSION }}
|
||||||
|
prerelease: ${{ inputs.prerelease }}
|
||||||
|
allowUpdates: true
|
||||||
|
body: |
|
||||||
|
${{ steps.Changelog.outputs.changelog }}
|
||||||
|
artifacts: |
|
||||||
|
addons.zip
|
||||||
|
*.addon
|
222
.github/workflows/update.yml
vendored
Executable file
222
.github/workflows/update.yml
vendored
Executable file
@ -0,0 +1,222 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Update Eudev
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
push:
|
||||||
|
description: 'push'
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
eudev:
|
||||||
|
description: 'update eudev'
|
||||||
|
default: true
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
eudev:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- version: 7.1
|
||||||
|
platform: apollolake
|
||||||
|
|
||||||
|
- version: 7.2
|
||||||
|
platform: apollolake
|
||||||
|
|
||||||
|
if: inputs.eudev == true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Init Env
|
||||||
|
run: |
|
||||||
|
git config --global user.email "info@auxxxilium.tech"
|
||||||
|
git config --global user.name "AuxXxilium"
|
||||||
|
sudo timedatectl set-timezone "Europe/Berlin"
|
||||||
|
|
||||||
|
- name: Get EnvDeploy
|
||||||
|
run: |
|
||||||
|
ROOT_PATH=${{ github.workspace }}
|
||||||
|
|
||||||
|
git clone https://github.com/SynologyOpenSource/pkgscripts-ng.git ${ROOT_PATH}/pkgscripts-ng
|
||||||
|
cd ${ROOT_PATH}/pkgscripts-ng
|
||||||
|
git checkout DSM${{ matrix.version }}
|
||||||
|
sudo ./EnvDeploy -v ${{ matrix.version }} -l # Get Available platforms
|
||||||
|
sudo ./EnvDeploy -q -v ${{ matrix.version }} -p ${{ matrix.platform }}
|
||||||
|
|
||||||
|
# Fault tolerance of pkgscripts-ng
|
||||||
|
if [ "${{ matrix.platform }}" == "broadwellntbap" -a "${{ matrix.version }}" == "7.1" ]; then
|
||||||
|
sed -i '/ broadwellnk BROADWELLNK/a\ broadwellntbap BROADWELLNTBAP linux-4.4.x Intel Broadwell with ntb kernel config in AP mode' ${ROOT_PATH}/pkgscripts-ng/include/platforms
|
||||||
|
fi
|
||||||
|
|
||||||
|
#ENV
|
||||||
|
mkdir -p ${ROOT_PATH}/source
|
||||||
|
|
||||||
|
ENV_PATH=${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}
|
||||||
|
sudo cp -al ${ROOT_PATH}/pkgscripts-ng ${ENV_PATH}/
|
||||||
|
|
||||||
|
sudo chroot ${ENV_PATH} << "EOF"
|
||||||
|
cd pkgscripts
|
||||||
|
|
||||||
|
version=${{ matrix.version }}; [ ${version:0:1} -gt 6 ] && sed -i 's/print(" ".join(kernels))/pass #&/' ProjectDepends.py
|
||||||
|
sed -i '/PLATFORM_FAMILY/a\\techo "PRODUCT=$PRODUCT" >> $file\n\techo "KSRC=$KERNEL_SEARCH_PATH" >> $file\n\techo "LINUX_SRC=$KERNEL_SEARCH_PATH" >> $file' include/build
|
||||||
|
./SynoBuild -c -p ${{ matrix.platform }}
|
||||||
|
|
||||||
|
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
|
||||||
|
if [ -f "${KSRC}/Makefile" ]; then
|
||||||
|
# gcc issue "unrecognized command-line option '--param=allow-store-data-races=0'".
|
||||||
|
[ "${{ matrix.version }}" == "7.2" ] && sed -i 's/--param=allow-store-data-races=0/--allow-store-data-races/g' ${KSRC}/Makefile
|
||||||
|
|
||||||
|
VERSION=`cat ${KSRC}/Makefile | grep ^VERSION | awk -F' ' '{print $3}'`
|
||||||
|
PATCHLEVEL=`cat ${KSRC}/Makefile | grep ^PATCHLEVEL | awk -F' ' '{print $3}'`
|
||||||
|
SUBLEVEL=`cat ${KSRC}/Makefile | grep ^SUBLEVEL | awk -F' ' '{print $3}'`
|
||||||
|
[ -f "/env32.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env32.mak
|
||||||
|
[ -f "/env64.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env64.mak
|
||||||
|
CCVER=`$CC -v 2>&1 | tail -n 1 | awk -F' ' '{print $3}'`
|
||||||
|
[ -f "/env32.mak" ] && echo "CCVER=${CCVER}" >> /env32.mak
|
||||||
|
[ -f "/env64.mak" ] && echo "CCVER=${CCVER}" >> /env64.mak
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
[ -f ${ENV_PATH}/env64.mak ] && ENV_FILE=${ENV_PATH}/env64.mak || ([ -f ${ENV_PATH}/env32.mak ] && ENV_FILE=${ENV_PATH}/env32.mak)
|
||||||
|
if [ -n "${ENV_FILE}" ]; then
|
||||||
|
KVER=`grep 'KVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
|
||||||
|
CCVER=`grep 'CCVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
|
||||||
|
[ -n "${KVER}" ] && echo "KVER=${KVER}" >> $GITHUB_ENV
|
||||||
|
[ -n "${CCVER}" ] && echo "CCVER=${CCVER}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Get Src
|
||||||
|
run: |
|
||||||
|
ROOT_PATH=${{ github.workspace }}
|
||||||
|
|
||||||
|
mkdir -p ${ROOT_PATH}/source/output
|
||||||
|
|
||||||
|
KVER=${{ env.KVER }}
|
||||||
|
|
||||||
|
sudo cp -a ${ROOT_PATH}/eudev/src ${ROOT_PATH}/source/input
|
||||||
|
|
||||||
|
sudo cp -a ${ROOT_PATH}/source ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/
|
||||||
|
|
||||||
|
- name: Make
|
||||||
|
run: |
|
||||||
|
ROOT_PATH=${{ github.workspace }}
|
||||||
|
|
||||||
|
sudo chroot build_env/ds.${{ matrix.platform }}-${{ matrix.version }} << "EOF"
|
||||||
|
sed -i 's/^CFLAGS=/#CFLAGS=/g; s/^CXXFLAGS=/#CXXFLAGS=/g' /env${BUILD_ARCH}.mak
|
||||||
|
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
|
||||||
|
|
||||||
|
# build kmod
|
||||||
|
git clone -c http.sslVerify=false --single-branch https://github.com/kmod-project/kmod.git /tmp/kmod
|
||||||
|
cd /tmp/kmod
|
||||||
|
git checkout v30
|
||||||
|
patch -p1 < /source/input/kmod.patch
|
||||||
|
./autogen.sh
|
||||||
|
./configure CC=${CC} CFLAGS='-O2' --host=${HOST} --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-tools --disable-manpages --disable-python --without-zstd --without-xz --without-zlib --without-openssl
|
||||||
|
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile
|
||||||
|
make all
|
||||||
|
make install
|
||||||
|
make DESTDIR=/source/output install
|
||||||
|
|
||||||
|
# build eudev
|
||||||
|
git clone -c http.sslVerify=false --single-branch https://github.com/systemd/systemd.git /tmp/systemd
|
||||||
|
git clone -c http.sslVerify=false --single-branch https://github.com/eudev-project/eudev.git /tmp/eudev
|
||||||
|
cd /tmp/eudev
|
||||||
|
git checkout v3.2.14
|
||||||
|
|
||||||
|
# error: 'for' loop initial declarations are only allowed in C99 or C11 mode
|
||||||
|
if [ "${{ matrix.version }}" = "6.2" ]; then
|
||||||
|
sed -i 's/for (char \*p/char \*p = NULL; for (p/g' ./src/shared/util.h
|
||||||
|
sed -i 's/for (size_t a/size_t a = 0; for(a/g; s/for (size_t i/size_t i = 0; for(i/g; s/for (uint16_t i/uint16_t i = 0; for(i/g' ./src/dmi_memory_id/dmi_memory_id.c
|
||||||
|
sed -i 's/for (size_t pos/size_t pos = 0; for (pos/g; s/for (size_t i/size_t i = 0; for(i/g' ./src/fido_id/fido_id_desc.c
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -vf /tmp/systemd/hwdb.d/*.ids /tmp/systemd/hwdb.d/*.hwdb hwdb/
|
||||||
|
./autogen.sh
|
||||||
|
./configure CC=${CC} --host=${HOST} --prefix=/usr --sysconfdir=/etc --disable-manpages --disable-selinux --disable-mtd_probe --enable-kmod
|
||||||
|
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile
|
||||||
|
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" all
|
||||||
|
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" DESTDIR=/source/output install
|
||||||
|
# ldd /source/output/usr/bin/kmod | awk '{if (match($3,"/")){ printf("%s "),$3 } }'
|
||||||
|
# ldd /source/output/usr/bin/udevadm | awk '{if (match($3,"/")){ printf("%s "),$3 } }'
|
||||||
|
rm -Rf /source/output/usr/share /source/output/usr/include /source/output/usr/lib/pkgconfig /source/output/usr/lib/libudev.*
|
||||||
|
cp -f ${ToolChainSysRoot}/usr/lib/libblkid.so.1 /source/output/usr/lib/libblkid.so.1
|
||||||
|
ln -sf /usr/bin/kmod /source/output/usr/sbin/depmod
|
||||||
|
cp -f /source/input/99-usb-realtek-net.rules /source/output/usr/lib/udev/rules.d/99-usb-realtek-net.rules
|
||||||
|
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage.rules
|
||||||
|
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage-tape.rules
|
||||||
|
rm -f /source/output/usr/lib/udev/rules.d/80-net-name-slot.rules
|
||||||
|
chown 1000.1000 -R /source/output
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo cp -a ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/output ${ROOT_PATH}/source/
|
||||||
|
sudo chmod a+rw -R ${ROOT_PATH}/source/output
|
||||||
|
|
||||||
|
- name: Tar to Artifacts
|
||||||
|
run: |
|
||||||
|
tar -zcf ${{ github.workspace }}/source/eudev-${{ matrix.version }}.tgz -C ${{ github.workspace }}/source/output .
|
||||||
|
|
||||||
|
- name: Upload to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: eudev-${{ matrix.version }}
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/source/eudev-*.tgz
|
||||||
|
|
||||||
|
- name: clean
|
||||||
|
run: |
|
||||||
|
sudo rm -rf ${{ github.workspace }}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/*
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: eudev
|
||||||
|
if: inputs.push == true
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Init Env
|
||||||
|
run: |
|
||||||
|
git config --global user.email "info@auxxxilium.tech"
|
||||||
|
git config --global user.name "AuxXxilium"
|
||||||
|
sudo timedatectl set-timezone "Europe/Berlin"
|
||||||
|
|
||||||
|
- name: download to artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: output
|
||||||
|
pattern: eudev-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: delete-artifact
|
||||||
|
uses: geekyeggo/delete-artifact@v5
|
||||||
|
with:
|
||||||
|
name: |
|
||||||
|
eudev-*
|
||||||
|
|
||||||
|
- name: Check and Push
|
||||||
|
run: |
|
||||||
|
if [ $(ls artifacts/*.tgz 2> /dev/null | wc -l) -gt 0 ]; then
|
||||||
|
echo "Copy eudev ..."
|
||||||
|
rm -f eudev/all/addons/eudev*.tgz
|
||||||
|
mv -f output/eudev-*.tgz rr-addons/eudev/all/addons/
|
||||||
|
|
||||||
|
echo "Git push ..."
|
||||||
|
git pull
|
||||||
|
status=$(git status -s | grep -E 'eudev/all/addons/' | awk '{printf " %s", $2}')
|
||||||
|
if [ -n "${status}" ]; then
|
||||||
|
git add ${status}
|
||||||
|
git commit -m "eudev: update $(date +%Y-%m-%d" "%H:%M:%S)"
|
||||||
|
git push -f
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No change ..."
|
||||||
|
fi
|
13
.gitignore
vendored
Normal file → Executable file
13
.gitignore
vendored
Normal file → Executable file
@ -1,9 +1,13 @@
|
|||||||
|
/_
|
||||||
|
*.addon
|
||||||
|
test.sh
|
||||||
|
.nvram
|
||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
|
||||||
|
|
||||||
# Object files
|
# Object files
|
||||||
*.o
|
*.o
|
||||||
*.ko
|
#*.ko
|
||||||
*.obj
|
*.obj
|
||||||
*.elf
|
*.elf
|
||||||
|
|
||||||
@ -24,8 +28,8 @@
|
|||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
# Shared objects (inc. Windows DLLs)
|
||||||
*.dll
|
*.dll
|
||||||
*.so
|
#*.so
|
||||||
*.so.*
|
#*.so.*
|
||||||
*.dylib
|
*.dylib
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
@ -50,3 +54,4 @@ modules.order
|
|||||||
Module.symvers
|
Module.symvers
|
||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
powersched/src/powersched
|
||||||
|
12
README.md
Normal file → Executable file
12
README.md
Normal file → Executable file
@ -1,2 +1,10 @@
|
|||||||
# arpl-addons
|
# Addons for Arc Redpill Loader
|
||||||
arpl project addon repository
|
|
||||||
|
### Links
|
||||||
|
|
||||||
|
- <a href="https://github.com/AuxXxilium">Overview</a>
|
||||||
|
- <a href="https://github.com/AuxXxilium/AuxXxilium/wiki">Wiki and Informations</a>
|
||||||
|
- <a href="https://github.com/AuxXxilium/arc/releases/latest">Download</a>
|
||||||
|
|
||||||
|
### Thanks
|
||||||
|
All code was based on the work of TTG, pocopico, jumkey, fbelavenuto and others involved in continuing TTG's original redpill-load project.
|
13
acpid/all/etc/acpi/events/power
Executable file
13
acpid/all/etc/acpi/events/power
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
# /etc/acpi/events/powerbtn
|
||||||
|
# This is called when the user presses the power button and calls
|
||||||
|
# /etc/acpi/powerbtn.sh for further processing.
|
||||||
|
|
||||||
|
# Optionally you can specify the placeholder %e. It will pass
|
||||||
|
# through the whole kernel event message to the program you've
|
||||||
|
# specified.
|
||||||
|
|
||||||
|
# We need to react on "button power.*" and "button/power.*" because
|
||||||
|
# of kernel changes.
|
||||||
|
|
||||||
|
event=button[ /]power
|
||||||
|
action=/etc/acpi/power.sh
|
6
acpid/all/etc/acpi/power.sh
Executable file
6
acpid/all/etc/acpi/power.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
logger -p err "Shutdown from ACPI"
|
||||||
|
[ -x /usr/syno/sbin/synopoweroff ] && \
|
||||||
|
/usr/syno/sbin/synopoweroff ||
|
||||||
|
/usr/sbin/poweroff
|
BIN
acpid/all/usr/sbin/acpid
Executable file
BIN
acpid/all/usr/sbin/acpid
Executable file
Binary file not shown.
60
acpid/install.sh
Executable file
60
acpid/install.sh
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon acpid - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
mkdir -p /tmpRoot/etc/acpi/events/
|
||||||
|
# [ ! -f /tmpRoot/etc/acpi/events/power.bak -a -f /tmpRoot/etc/acpi/events/power ] && cp -vf /tmpRoot/etc/acpi/events/power /tmpRoot/etc/acpi/events/power.bak
|
||||||
|
# [ ! -f /tmpRoot/etc/acpi/power.sh.bak -a -f /tmpRoot/etc/acpi/power.sh ] && cp -vf /tmpRoot/etc/acpi/power.sh /tmpRoot/etc/acpi/power.sh.bak
|
||||||
|
# [ ! -f /tmpRoot/usr/sbin/acpid.bak -a -f /tmpRoot/usr/sbin/acpid ] && cp -vf /tmpRoot/usr/sbin/acpid /tmpRoot/usr/sbin/acpid.bak
|
||||||
|
cp -vf /etc/acpi/events/power /tmpRoot/etc/acpi/events/power
|
||||||
|
cp -vf /etc/acpi/power.sh /tmpRoot/etc/acpi/power.sh
|
||||||
|
cp -vf /usr/sbin/acpid /tmpRoot/usr/sbin/acpid
|
||||||
|
if [ -f /usr/lib/modules/button.ko ]; then
|
||||||
|
cp -vf /usr/lib/modules/button.ko /tmpRoot/usr/lib/modules/button.ko
|
||||||
|
else
|
||||||
|
echo "No button.ko found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/acpid.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=addon acpid" >>${DEST}
|
||||||
|
echo "DefaultDependencies=no" >>${DEST}
|
||||||
|
echo "IgnoreOnIsolate=true" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Restart=always" >>${DEST}
|
||||||
|
echo "RestartSec=30" >>${DEST}
|
||||||
|
echo "ExecStartPre=-/usr/sbin/modprobe button" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/sbin/acpid -f" >>${DEST}
|
||||||
|
echo "ExecStopPost=-/usr/sbin/modprobe -r button" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[X-Synology]" >>${DEST}
|
||||||
|
echo "Author=Virtualization Team" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/acpid.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/acpid.service
|
||||||
|
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon acpid - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/acpid.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/acpid.service"
|
||||||
|
|
||||||
|
rm -f /tmpRoot/etc/acpi/events/power
|
||||||
|
rm -f /tmpRoot/etc/acpi/power.sh
|
||||||
|
rm -f /tmpRoot/usr/sbin/acpid
|
||||||
|
# [ -f /tmpRoot/etc/acpi/events/power.bak ] && mv -vf /tmpRoot/etc/acpi/events/power.bak /tmpRoot/etc/acpi/events/power
|
||||||
|
# [ -f /tmpRoot/etc/acpi/power.sh.bak ] && mv -vf /tmpRoot/etc/acpi/power.sh.bak /tmpRoot/etc/acpi/power.sh
|
||||||
|
# [ -f /tmpRoot/usr/sbin/acpid.bak ] && mv -vf /tmpRoot/usr/sbin/acpid.bak /tmpRoot/usr/sbin/acpid
|
||||||
|
fi
|
19
acpid/manifest.yml
Executable file
19
acpid/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: acpid
|
||||||
|
description: "Daemon for delivering ACPI events (Shutdown Button, CPU Frequency, etc.)"
|
||||||
|
system: true
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
31
addincards/install.sh
Executable file
31
addincards/install.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon addincards - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
MODEL="$(cat /proc/sys/kernel/syno_hw_version)"
|
||||||
|
FILE="/tmpRoot/usr/syno/etc.defaults/adapter_cards.conf"
|
||||||
|
|
||||||
|
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
|
||||||
|
|
||||||
|
cp -f "${FILE}" "${FILE}.tmp"
|
||||||
|
echo -n "" >"${FILE}"
|
||||||
|
for N in $(cat "${FILE}.tmp" 2>/dev/null | grep '\['); do
|
||||||
|
echo "${N}" >>"${FILE}"
|
||||||
|
echo "${MODEL}=yes" >>"${FILE}"
|
||||||
|
done
|
||||||
|
rm -f "${FILE}.tmp"
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon addincards - ${1}"
|
||||||
|
|
||||||
|
FILE="/tmpRoot/usr/syno/etc.defaults/adapter_cards.conf"
|
||||||
|
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
|
||||||
|
fi
|
19
addincards/manifest.yml
Executable file
19
addincards/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: addincards
|
||||||
|
description: "Remove the Modelrestrictions for official Addin Cards."
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
84
amepatch/all/usr/bin/amepatch.sh
Executable file
84
amepatch/all/usr/bin/amepatch.sh
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ -d /var/packages/CodecPack || -d /volume1/@appstore/CodecPack ]]; then
|
||||||
|
|
||||||
|
[ -d "/var/packages/CodecPack/target/apparmor" ] && apparmor="/var/packages/CodecPack/target/apparmor"
|
||||||
|
[ -d "/volume1/@appstore/CodecPack/apparmor" ] && apparmor="/volume1/@appstore/CodecPack/apparmor"
|
||||||
|
/usr/syno/etc/rc.sysv/apparmor.sh remove_packages_profile 0 CodecPack
|
||||||
|
# disable apparmor check for AME
|
||||||
|
if [ -e "${apparmor}" ]; then
|
||||||
|
mv -f "${apparmor}" "${apparmor}.bak"
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /etc.defaults/VERSION
|
||||||
|
|
||||||
|
values=('669066909066906690' 'B801000000' '30')
|
||||||
|
hex_values=('1F28' '48F5' '4921' '4953' '4975' '9AC8')
|
||||||
|
indices=(0 1 1 1 1 2)
|
||||||
|
cp_usr_path='/var/packages/CodecPack/target/usr'
|
||||||
|
so="$cp_usr_path/lib/libsynoame-license.so"
|
||||||
|
so_backup="$cp_usr_path/lib/libsynoame-license.so.orig"
|
||||||
|
lic="/usr/syno/etc/license/data/ame/offline_license.json"
|
||||||
|
lic_backup="/usr/syno/etc/license/data/ame/offline_license.json.orig"
|
||||||
|
licsig="/usr/syno/etc/license/data/ame/offline_license.sig"
|
||||||
|
licsig_backup="/usr/syno/etc/license/data/ame/offline_license.sig.orig"
|
||||||
|
|
||||||
|
if [ ! -f "$so_backup" ]; then
|
||||||
|
cp -p "$so" "$so_backup"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$lic_backup" ]; then
|
||||||
|
cp -p "$lic" "$lic_backup"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$licsig_backup" ]; then
|
||||||
|
cp -p "$licsig" "$licsig_backup"
|
||||||
|
fi
|
||||||
|
|
||||||
|
hash_to_check="$(md5sum -b "$so" | awk '{print $1}')"
|
||||||
|
|
||||||
|
if [ "$hash_to_check" = "fcc1084f4eadcf5855e6e8494fb79e23" ]; then
|
||||||
|
hex_values=('1F28' '48F5' '4921' '4953' '4975' '9AC8')
|
||||||
|
content='[{"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "hevc", "type": "free"}, "licenseContent": 1}, {"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "aac", "type": "free"}, "licenseContent": 1}]'
|
||||||
|
elif [ "$hash_to_check" = "923fd0d58e79b7dc0f6c377547545930" ]; then
|
||||||
|
hex_values=('1F28' '48F5' '4921' '4953' '4975' '9AC8')
|
||||||
|
content='[{"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "hevc", "type": "free"}, "licenseContent": 1}, {"appType": 14, "appName": "ame", "follow": ["device"], "server_time": 1666000000, "registered_at": 1651000000, "expireTime": 0, "status": "valid", "firstActTime": 1651000001, "extension_gid": null, "licenseCode": "0", "duration": 1576800000, "attribute": {"codec": "aac", "type": "free"}, "licenseContent": 1}]'
|
||||||
|
elif [ "$hash_to_check" = "09e3adeafe85b353c9427d93ef0185e9" ]; then
|
||||||
|
hex_values=('3718' '60A5' '60D1' '6111' '6137' 'B5F0')
|
||||||
|
content='[{"attribute": {"codec": "hevc", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}, {"attribute": {"codec": "aac", "type": "free"}, "status": "valid", "extension_gid": null, "expireTime": 0, "appName": "ame", "follow": ["device"], "duration": 1576800000, "appType": 14, "licenseContent": 1, "registered_at": 1649315995, "server_time": 1685421618, "firstActTime": 1649315995, "licenseCode": "0"}]'
|
||||||
|
else
|
||||||
|
echo "MD5 mismatch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ((i = 0; i < ${#hex_values[@]}; i++)); do
|
||||||
|
offset=$(( 0x${hex_values[i]} + 0x8000 ))
|
||||||
|
value=${values[indices[i]]}
|
||||||
|
printf '%s' "$value" | xxd -r -p | dd of="$so" bs=1 seek="$offset" conv=notrunc
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "AME Patch: Error while writing to file!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "${lic}")"
|
||||||
|
rm -f "${lic}"
|
||||||
|
echo "${content}" >"${lic}"
|
||||||
|
|
||||||
|
if "$cp_usr_path/bin/synoame-bin-check-license"; then
|
||||||
|
"$cp_usr_path/bin/synoame-bin-auto-install-needed-codec"
|
||||||
|
echo -e "AME Patch: Successful!"
|
||||||
|
else
|
||||||
|
if [ -f "$so_backup" ]; then
|
||||||
|
mv -f "$so_backup" "$so"
|
||||||
|
fi
|
||||||
|
if [ -f "$lic_backup" ]; then
|
||||||
|
mv -f "$lic_backup" "$lic"
|
||||||
|
fi
|
||||||
|
if [ -f "$licsig_backup" ]; then
|
||||||
|
mv -f "$licsig_backup" "$licsig"
|
||||||
|
fi
|
||||||
|
echo -e "AME Patch: Unsuccessful!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
41
amepatch/install.sh
Executable file
41
amepatch/install.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon amepatch - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/amepatch.sh /tmpRoot/usr/bin/amepatch.sh
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/amepatch.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=addon amepatch" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/amepatch.sh" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/amepatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/amepatch.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon amepatch - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/amepatch.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/amepatch.service"
|
||||||
|
|
||||||
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "/usr/bin/amepatch.sh -r" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "rm -f /usr/bin/amepatch.sh" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
fi
|
19
amepatch/manifest.yml
Executable file
19
amepatch/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: amepatch
|
||||||
|
description: "Dynamic Licensepatch for AME (Don't use with Arc Patch)"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
42
bootwait/install.sh
Executable file
42
bootwait/install.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "early" ]; then
|
||||||
|
echo "Installing addon bootwait - ${1}"
|
||||||
|
wait_time=30 # maximum wait time in seconds
|
||||||
|
|
||||||
|
dump_all_partitions() {
|
||||||
|
echo ""
|
||||||
|
echo "========== BEGIN DUMP OF ALL PARTITIONS DETECTED ==========="
|
||||||
|
/usr/sbin/sfdisk -l
|
||||||
|
echo "========== END OF DUMP OF ALL PARTITIONS DETECTED =========="
|
||||||
|
}
|
||||||
|
|
||||||
|
time_counter=0
|
||||||
|
while [ ! -b /dev/synoboot ] && [ $time_counter -lt $wait_time ]; do
|
||||||
|
sleep 1
|
||||||
|
echo "Still waiting for boot device (waited $((time_counter = time_counter + 1)) of ${wait_time} seconds)"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -b /dev/synoboot ]; then
|
||||||
|
touch /.no_synoboot
|
||||||
|
echo "ERROR: Timeout waiting for /dev/synoboot device to appear."
|
||||||
|
echo "Most likely your vid/pid configuration is not correct, or you don't have drivers needed for your USB/SATA controller"
|
||||||
|
dump_all_partitions
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -b /dev/synoboot3 ] || sleep 1 # sometimes we can hit synoboot but before partscan
|
||||||
|
if [ ! -b /dev/synoboot1 ] || [ ! -b /dev/synoboot2 ] || [ ! -b /dev/synoboot3 ]; then
|
||||||
|
echo "The /dev/synoboot device exists but it does not contain expected partitions (>=3 partitions)"
|
||||||
|
dump_all_partitions
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Confirmed a valid-looking /dev/synoboot device"
|
||||||
|
fi
|
19
bootwait/manifest.yml
Normal file
19
bootwait/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: bootwait
|
||||||
|
description: "Boot process waits until boot device (`/dev/synoboot`) and PCIe Device are available."
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
439
codecpatch/all/usr/bin/codecpatch.sh
Executable file
439
codecpatch/all/usr/bin/codecpatch.sh
Executable file
@ -0,0 +1,439 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
# https://github.com/wirgen/synocodectool-patch
|
||||||
|
# 2023/11/1
|
||||||
|
|
||||||
|
set -eo pipefail;
|
||||||
|
shopt -s nullglob;
|
||||||
|
|
||||||
|
#variables
|
||||||
|
bin_file="synocodectool"
|
||||||
|
conf_file="activation.conf"
|
||||||
|
conf_path="/usr/syno/etc/codec"
|
||||||
|
conf_string='{"success":true,"activated_codec":["hevc_dec","ac3_dec","h264_dec","h264_enc","aac_dec","aac_enc","mpeg4part2_dec","vc1_dec","vc1_enc"],"token":"123456789987654abc"}'
|
||||||
|
opmode="patchhelp"
|
||||||
|
|
||||||
|
#arrays
|
||||||
|
declare -A binhash_version_list=(
|
||||||
|
["cde88ed8fdb2bfeda8de52ef3adede87a72326ef"]="6.0-7321-0_6.0.3-8754-8"
|
||||||
|
["ec0c3f5bbb857fa84f5d1153545d30d7b408520b"]="6.1-15047-0_6.1.1-15101-4"
|
||||||
|
["1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"]="6.1.2-15132-0_6.1.3-15152-8"
|
||||||
|
["26e42e43b393811c176dac651efc5d61e4569305"]="6.1.4-15217-0_6.2-23739-2"
|
||||||
|
["1d01ee38211f21c67a4311f90315568b3fa530e6"]="6.2.1-23824-0_6.2.3-25426-3"
|
||||||
|
["c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"]="7.0.1-42216-0_7.0.1-42218-3"
|
||||||
|
["796ac7fab2dcad7978a0e8ae48abc9150aba916c"]="7.1-42661-0_7.1-42661-0"
|
||||||
|
["22445f5b0d8b6714954b50930c47b8805cf32b98"]="7.1-42661-0_7.1-42661-0"
|
||||||
|
["18461b62813166652fd64a96e06237fde81925f7"]="7.1.1-42962-0_7.1.1-42962-6"
|
||||||
|
["d316d5b2b080346b4bc197ad5ad7994ac043a15d"]="7.2-64570-0_7.2-64570-3"
|
||||||
|
["a205aa337d808213cf6d4d839b035cde0237b424"]="7.2.1-69057-0_7.2.1-69057-5"
|
||||||
|
)
|
||||||
|
|
||||||
|
declare -A patchhash_binhash_list=(
|
||||||
|
["e5c1a65b3967968560476fcda5071fd37db40223"]="cde88ed8fdb2bfeda8de52ef3adede87a72326ef"
|
||||||
|
["d58f5b33ff2b6f2141036837ddf15dd5188384c6"]="ec0c3f5bbb857fa84f5d1153545d30d7b408520b"
|
||||||
|
["56ca9adaf117e8aae9a3a2e29bbcebf0d8903a99"]="1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"
|
||||||
|
["511dec657daa60b0f11da20295e2c665ba2c749c"]="26e42e43b393811c176dac651efc5d61e4569305"
|
||||||
|
["93067026c251b100e27805a8b4b9d8f0ae8e291c"]="1d01ee38211f21c67a4311f90315568b3fa530e6"
|
||||||
|
["873749b00e1624df4b01335e0b69102acc185eb9"]="c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"
|
||||||
|
["06d543b2aab5ea73600ca96497febdad96dc7864"]="796ac7fab2dcad7978a0e8ae48abc9150aba916c"
|
||||||
|
["3a5ed18dc41ff243f3481b6e3cf4770651df0b54"]="22445f5b0d8b6714954b50930c47b8805cf32b98"
|
||||||
|
["4bfa2a72da607752435e432545f98f1a0b3815a8"]="18461b62813166652fd64a96e06237fde81925f7"
|
||||||
|
["8ffe49d91dc0fcd3268ff1afcbc9132d1ae634d1"]="d316d5b2b080346b4bc197ad5ad7994ac043a15d"
|
||||||
|
["1f4491bf5f27f0719ddebdcab6ff4eff56c64b2c"]="a205aa337d808213cf6d4d839b035cde0237b424"
|
||||||
|
)
|
||||||
|
|
||||||
|
declare -A binhash_patch_list=(
|
||||||
|
["cde88ed8fdb2bfeda8de52ef3adede87a72326ef"]="00002dc0: 27000084c0eb4cb9b6000000badd6940\n00003660: 24f0000000e8961e000084c00f84b400"
|
||||||
|
["ec0c3f5bbb857fa84f5d1153545d30d7b408520b"]="00002dc0: 27000084c0eb4cb9b7000000bafd6940\n000036f0: 0000e8291e000084c0eb1eb9ec000000"
|
||||||
|
["1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"]="00002dc0: 27000084c0eb4cb9b7000000baad6a40\n000036f0: 0000e8291e000084c0eb1eb9ec000000"
|
||||||
|
["26e42e43b393811c176dac651efc5d61e4569305"]="00002dc0: 27000084c0eb4cb9ba000000badf6a40\n00003710: f0000000e8271e000084c0eb1eb9ef00"
|
||||||
|
["1d01ee38211f21c67a4311f90315568b3fa530e6"]="00002dc0: 27000084c0eb4cb9bd000000baf76a40\n00003720: 24f0000000e8261e000084c0eb1eb9f2"
|
||||||
|
["c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"]="00002dc0: 000084c0eb2141b8c1000000b9586c40\n00003780: 1d000084c0e90d0100009041b8f60000"
|
||||||
|
["796ac7fab2dcad7978a0e8ae48abc9150aba916c"]="000035b0: 74cd4889efe8f623000084c0eb004c8d\n000040a0: fdffff4c89efe80519000084c0eb0048"
|
||||||
|
["22445f5b0d8b6714954b50930c47b8805cf32b98"]="00003850: e7e89a27000084c0eb00488dac249000\n00004340: fdffff4c89efe8a51c000084c0eb0048"
|
||||||
|
["18461b62813166652fd64a96e06237fde81925f7"]="000038e0: e7e89a27000084c0eb00488dac249000\n000043d0: fdffff4c89efe8a51c000084c0eb0048"
|
||||||
|
["d316d5b2b080346b4bc197ad5ad7994ac043a15d"]="00004220: 08fdffffe87722000084c090e9000000\n00004390: ffe80a21000084c090e900000000488b"
|
||||||
|
["a205aa337d808213cf6d4d839b035cde0237b424"]="00004220: 08fdffffe87722000084c090e9000000\n00004390: ffe80a21000084c090e900000000488b"
|
||||||
|
)
|
||||||
|
|
||||||
|
declare -a binpath_list=()
|
||||||
|
|
||||||
|
declare -a path_list=(
|
||||||
|
"/usr/syno/bin"
|
||||||
|
"/volume1/@appstore/VideoStation/bin"
|
||||||
|
"/volume2/@appstore/VideoStation/bin"
|
||||||
|
"/volume3/@appstore/VideoStation/bin"
|
||||||
|
"/volume1/@appstore/MediaServer/bin"
|
||||||
|
"/volume2/@appstore/MediaServer/bin"
|
||||||
|
"/volume3/@appstore/MediaServer/bin"
|
||||||
|
"/volume1/@appstore/SurveillanceStation/bin"
|
||||||
|
"/volume2/@appstore/SurveillanceStation/bin"
|
||||||
|
"/volume3/@appstore/SurveillanceStation/bin"
|
||||||
|
"/volume1/@appstore/CodecPack/bin"
|
||||||
|
"/volume2/@appstore/CodecPack/bin"
|
||||||
|
"/volume3/@appstore/CodecPack/bin"
|
||||||
|
"/volume1/@appstore/AudioStation/bin"
|
||||||
|
"/volume2/@appstore/AudioStation/bin"
|
||||||
|
"/volume3/@appstore/AudioStation/bin"
|
||||||
|
)
|
||||||
|
|
||||||
|
declare -a versions_list=(
|
||||||
|
"6.0 7321-0"
|
||||||
|
"6.0 7321-1"
|
||||||
|
"6.0 7321-2"
|
||||||
|
"6.0 7321-3"
|
||||||
|
"6.0 7321-4"
|
||||||
|
"6.0 7321-5"
|
||||||
|
"6.0 7321-6"
|
||||||
|
"6.0 7321-7"
|
||||||
|
"6.0.1 7393-0"
|
||||||
|
"6.0.1 7393-1"
|
||||||
|
"6.0.1 7393-2"
|
||||||
|
"6.0.2 8451-0"
|
||||||
|
"6.0.2 8451-1"
|
||||||
|
"6.0.2 8451-2"
|
||||||
|
"6.0.2 8451-3"
|
||||||
|
"6.0.2 8451-4"
|
||||||
|
"6.0.2 8451-5"
|
||||||
|
"6.0.2 8451-6"
|
||||||
|
"6.0.2 8451-7"
|
||||||
|
"6.0.2 8451-8"
|
||||||
|
"6.0.2 8451-9"
|
||||||
|
"6.0.2 8451-10"
|
||||||
|
"6.0.2 8451-11"
|
||||||
|
"6.0.3 8754-0"
|
||||||
|
"6.0.3 8754-1"
|
||||||
|
"6.0.3 8754-2"
|
||||||
|
"6.0.3 8754-3"
|
||||||
|
"6.0.3 8754-4"
|
||||||
|
"6.0.3 8754-5"
|
||||||
|
"6.0.3 8754-6"
|
||||||
|
"6.0.3 8754-7"
|
||||||
|
"6.0.3 8754-8"
|
||||||
|
"6.1 15047-0"
|
||||||
|
"6.1 15047-1"
|
||||||
|
"6.1 15047-2"
|
||||||
|
"6.1.1 15101-0"
|
||||||
|
"6.1.1 15101-1"
|
||||||
|
"6.1.1 15101-2"
|
||||||
|
"6.1.1 15101-3"
|
||||||
|
"6.1.1 15101-4"
|
||||||
|
"6.1.2 15132-0"
|
||||||
|
"6.1.2 15132-1"
|
||||||
|
"6.1.3 15152-0"
|
||||||
|
"6.1.3 15152-1"
|
||||||
|
"6.1.3 15152-2"
|
||||||
|
"6.1.3 15152-3"
|
||||||
|
"6.1.3 15152-4"
|
||||||
|
"6.1.3 15152-5"
|
||||||
|
"6.1.3 15152-6"
|
||||||
|
"6.1.3 15152-7"
|
||||||
|
"6.1.3 15152-8"
|
||||||
|
"6.1.4 15217-0"
|
||||||
|
"6.1.4 15217-1"
|
||||||
|
"6.1.4 15217-2"
|
||||||
|
"6.1.4 15217-3"
|
||||||
|
"6.1.4 15217-4"
|
||||||
|
"6.1.4 15217-5"
|
||||||
|
"6.1.4 15217-0"
|
||||||
|
"6.1.5 15254-0"
|
||||||
|
"6.1.5 15254-1"
|
||||||
|
"6.1.6 15266-0"
|
||||||
|
"6.1.6 15266-1"
|
||||||
|
"6.1.7 15284-0"
|
||||||
|
"6.1.7 15284-1"
|
||||||
|
"6.1.7 15284-2"
|
||||||
|
"6.1.7 15284-3"
|
||||||
|
"6.2 23739-0"
|
||||||
|
"6.2 23739-1"
|
||||||
|
"6.2 23739-2"
|
||||||
|
"6.2.1 23824-0"
|
||||||
|
"6.2.1 23824-1"
|
||||||
|
"6.2.1 23824-2"
|
||||||
|
"6.2.1 23824-3"
|
||||||
|
"6.2.1 23824-4"
|
||||||
|
"6.2.1 23824-5"
|
||||||
|
"6.2.1 23824-6"
|
||||||
|
"6.2.2 24922-0"
|
||||||
|
"6.2.2 24922-1"
|
||||||
|
"6.2.2 24922-2"
|
||||||
|
"6.2.2 24922-3"
|
||||||
|
"6.2.2 24922-4"
|
||||||
|
"6.2.2 24922-5"
|
||||||
|
"6.2.2 24922-6"
|
||||||
|
"6.2.3 25423-0"
|
||||||
|
"6.2.3 25426-0"
|
||||||
|
"6.2.3 25426-2"
|
||||||
|
"6.2.3 25426-3"
|
||||||
|
"7.0.1 42218-0"
|
||||||
|
"7.0.1 42218-1"
|
||||||
|
"7.0.1 42218-2"
|
||||||
|
"7.0.1 42218-3"
|
||||||
|
"7.1 42661-0"
|
||||||
|
"7.1 42661-1"
|
||||||
|
"7.1 42661-2"
|
||||||
|
"7.1 42661-3"
|
||||||
|
"7.1 42661-4"
|
||||||
|
"7.1.1 42951"
|
||||||
|
"7.1.1 42962-0"
|
||||||
|
"7.1.1 42962-1"
|
||||||
|
"7.1.1 42962-2"
|
||||||
|
"7.1.1 42962-3"
|
||||||
|
"7.1.1 42962-4"
|
||||||
|
"7.1.1 42962-5"
|
||||||
|
"7.1.1 42962-6"
|
||||||
|
"7.2 64570-0"
|
||||||
|
"7.2 64570-1"
|
||||||
|
"7.2 64570-2"
|
||||||
|
"7.2 64570-3"
|
||||||
|
"7.2.1 69057-0"
|
||||||
|
"7.2.1 69057-1"
|
||||||
|
"7.2.1 69057-2"
|
||||||
|
"7.2.1 69057-3"
|
||||||
|
"7.2.1 69057-4"
|
||||||
|
"7.2.1 69057-5"
|
||||||
|
)
|
||||||
|
|
||||||
|
#functions
|
||||||
|
print_usage() {
|
||||||
|
printf "
|
||||||
|
SYNOPSIS
|
||||||
|
patch.sh [-h] [-p|-r|-l]
|
||||||
|
DESCRIPTION
|
||||||
|
Patch to enable transcoding without a valid serial in DSM 6+
|
||||||
|
-h Print this help message
|
||||||
|
-p Patch synocodectool
|
||||||
|
-r Restore from original from backup
|
||||||
|
-l List supported DSM versions
|
||||||
|
"
|
||||||
|
}
|
||||||
|
check_path () {
|
||||||
|
for i in "${path_list[@]}"; do
|
||||||
|
if [ -e "$i/$bin_file" ]; then
|
||||||
|
binpath_list+=( "$i/$bin_file" )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
check_version () {
|
||||||
|
local ver="$1"
|
||||||
|
for i in "${versions_list[@]}" ; do
|
||||||
|
[[ "$i" == "$ver" ]] && return 0
|
||||||
|
done || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
list_versions () {
|
||||||
|
for i in "${versions_list[@]}"; do
|
||||||
|
echo "$i"
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
patch_menu() {
|
||||||
|
local options=("$@")
|
||||||
|
echo "Available binaries to patch/restore:"
|
||||||
|
local PS3="Please choose which binary you want to patch/restore:"
|
||||||
|
select option in "${options[@]}" "Quit"; do
|
||||||
|
if [[ $REPLY = "$(( ${#options[@]}+1 ))" ]] ; then
|
||||||
|
echo "Goodbye"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
bin_path="$option"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_menu() {
|
||||||
|
local options=("$@")
|
||||||
|
echo "Available backups to restore:"
|
||||||
|
local PS3="Please choose which binary you want to restore to $bin_path:"
|
||||||
|
select option in "${options[@]}" "Quit"; do
|
||||||
|
if [[ $REPLY = "$(( ${#options[@]}+1 ))" ]] ; then
|
||||||
|
echo "Goodbye"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
backup_file="$option"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
patch_common () {
|
||||||
|
source "/etc/VERSION"
|
||||||
|
dsm_version="$productversion $buildnumber-$smallfixnumber"
|
||||||
|
if [[ ! "$dsm_version" ]] ; then
|
||||||
|
echo "Something went wrong. Could not fetch DSM version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Detected DSM version: $dsm_version"
|
||||||
|
|
||||||
|
if ! check_version "$dsm_version" ; then
|
||||||
|
echo "Patch for DSM Version ($dsm_version) not found."
|
||||||
|
echo "Patch is available for versions: "
|
||||||
|
list_versions
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Patch for DSM Version ($dsm_version) AVAILABLE!"
|
||||||
|
check_path
|
||||||
|
|
||||||
|
if ! (( ${#binpath_list[@]} )) ; then
|
||||||
|
echo "Something went wrong. Could not find synocodectool"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
patch_menu "${binpath_list[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
patch () {
|
||||||
|
patch_common
|
||||||
|
local backup_path="${bin_path%??????????????}/backup"
|
||||||
|
local synocodectool_hash="$(sha1sum "$bin_path" | cut -f1 -d\ )"
|
||||||
|
if [[ "${binhash_version_list[$synocodectool_hash]+isset}" ]] ; then
|
||||||
|
local backup_identifier="${synocodectool_hash:0:8}"
|
||||||
|
if [[ -f "$backup_path/$bin_file.$backup_identifier" ]]; then
|
||||||
|
backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
|
||||||
|
if [[ "${binhash_version_list[$backup_hash]+isset}" ]]; then
|
||||||
|
echo "Restored synocodectool and valid backup detected (DSM ${binhash_version_list[$backup_hash]}) . Patching..."
|
||||||
|
echo -e "${binhash_patch_list[$synocodectool_hash]}" | xxd -r - "$bin_path"
|
||||||
|
echo "Patched successfully"
|
||||||
|
echo "Creating spoofed activation.conf.."
|
||||||
|
if [ ! -e "$conf_path/$conf_file" ] ; then
|
||||||
|
mkdir -p $conf_path
|
||||||
|
echo "$conf_string" > "$conf_path/$conf_file"
|
||||||
|
chattr +i "$conf_path/$conf_file"
|
||||||
|
echo "Spoofed activation.conf created successfully"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
chattr -i "$conf_path/$conf_file"
|
||||||
|
rm "$conf_path/$conf_file"
|
||||||
|
echo "$conf_string" > "$conf_path/$conf_file"
|
||||||
|
chattr +i "$conf_path/$conf_file"
|
||||||
|
echo "Spoofed activation.conf created successfully"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Corrupted backup and original synocodectool detected. Overwriting backup..."
|
||||||
|
mkdir -p "$backup_path"
|
||||||
|
cp -p "$bin_path" \
|
||||||
|
"$backup_path/$bin_file.$backup_identifier"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Detected valid synocodectool. Creating backup.."
|
||||||
|
mkdir -p "$backup_path"
|
||||||
|
cp -p "$bin_path" \
|
||||||
|
"$backup_path/$bin_file.$backup_identifier"
|
||||||
|
echo "Patching..."
|
||||||
|
echo -e "${binhash_patch_list[$synocodectool_hash]}" | xxd -r - "$bin_path"
|
||||||
|
echo "Patched"
|
||||||
|
echo "Creating spoofed activation.conf.."
|
||||||
|
if [ ! -e "$conf_path/$conf_file" ] ; then
|
||||||
|
mkdir -p $conf_path
|
||||||
|
echo "$conf_string" > "$conf_path/$conf_file"
|
||||||
|
chattr +i "$conf_path/$conf_file"
|
||||||
|
echo "Spoofed activation.conf created successfully"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
chattr -i "$conf_path/$conf_file"
|
||||||
|
rm "$conf_path/$conf_file"
|
||||||
|
echo "$conf_string" > "$conf_path/$conf_file"
|
||||||
|
chattr +i "$conf_path/$conf_file"
|
||||||
|
echo "Spoofed activation.conf created successfully"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [[ "${patchhash_binhash_list[$synocodectool_hash]+isset}" ]]; then
|
||||||
|
local original_hash="${patchhash_binhash_list[$synocodectool_hash]}"
|
||||||
|
local backup_identifier="${original_hash:0:8}"
|
||||||
|
if [[ -f "$backup_path/$bin_file.$backup_identifier" ]]; then
|
||||||
|
backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
|
||||||
|
if [[ "$original_hash"="$backup_hash" ]]; then
|
||||||
|
echo "Valid backup and patched synocodectool detected. Skipping patch."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Patched synocodectool and corrupted backup detected. Skipping patch."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Patched synocodectool and no backup detected. Skipping patch."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Corrupted synocodectool detected. Please use the -r option to try restoring it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rollback () {
|
||||||
|
patch_common
|
||||||
|
local backup_path="${bin_path%??????????????}/backup"
|
||||||
|
local synocodectool_hash="$(sha1sum "$bin_path" | cut -f1 -d\ )"
|
||||||
|
if [[ "${patchhash_binhash_list[$synocodectool_hash]+isset}" ]] ; then
|
||||||
|
local original_hash="${patchhash_binhash_list[$synocodectool_hash]}"
|
||||||
|
local backup_identifier="${original_hash:0:8}"
|
||||||
|
if [[ -e "$backup_path/$bin_file.$backup_identifier" ]] ; then
|
||||||
|
local backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
|
||||||
|
if [[ "$original_hash" = "$backup_hash" ]]; then
|
||||||
|
cp -p "$backup_path/$bin_file.$backup_identifier" \
|
||||||
|
"$bin_path"
|
||||||
|
echo "Backup restored successfully (DSM ${binhash_version_list[$backup_hash]})"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "No valid backup found for patched synocodectool currently in use. You can download the original file for DSM ${binhash_version_list[$original_hash]} from https://github.com/stl88083365/synocodectool-patch/."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No backups found for patched synocodectool currently in use. You can download the original file for DSM ${binhash_version_list[$original_hash]} from https://github.com/stl88083365/synocodectool-patch/."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ "${binhash_version_list[$synocodectool_hash]+isset}" ]]; then
|
||||||
|
echo "Detected unpatched original synocodectool. Restoring not neccessary!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Detected corrupted synocodectool."
|
||||||
|
local backup_files=( "$backup_path"/* )
|
||||||
|
if (( ${#backup_files[@]} )); then
|
||||||
|
restore_menu "${backup_files[@]}"
|
||||||
|
echo "Checking Hash.."
|
||||||
|
local backup_hash="$(sha1sum "$backup_file" | cut -f1 -d\ )"
|
||||||
|
if [[ "${binhash_version_list[$backup_hash]+isset}" ]]; then
|
||||||
|
cp -p "$backup_file" \
|
||||||
|
"$bin_path"
|
||||||
|
echo "Backup restored successfully (DSM ${binhash_version_list[$backup_hash]})"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Not a valid backup. You can either try restoring another backup or download the original file for DSM $dsm_version from https://github.com/stl88083365/synocodectool-patch/."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No backups found. You can download the original file for DSM $dsm_version from https://github.com/stl88083365/synocodectool-patch/."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#main()
|
||||||
|
if [ ! ${USER} = "root" ]; then
|
||||||
|
echo "Please run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while getopts "prhl" flag; do
|
||||||
|
case "${flag}" in
|
||||||
|
p) opmode="patch";;
|
||||||
|
r) opmode="patchrollback" ;;
|
||||||
|
h) opmode="${opmode}" ;;
|
||||||
|
l) opmode="listversions" ;;
|
||||||
|
*) echo "Incorrect option specified in command line" ; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
case "${opmode}" in
|
||||||
|
patch) patch ;;
|
||||||
|
patchrollback) rollback ;;
|
||||||
|
patchhelp) print_usage ; exit 2 ;;
|
||||||
|
listversions) list_versions ;;
|
||||||
|
*) echo "Incorrect combination of flags. Use option -h to get help."
|
||||||
|
exit 2 ;;
|
||||||
|
esac
|
41
codecpatch/install.sh
Executable file
41
codecpatch/install.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon codecpatch - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/codecpatch.sh /tmpRoot/usr/bin/codecpatch.sh
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/codecpatch.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=addon codecpatch" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/codecpatch.sh -p" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/codecpatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/codecpatch.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon codecpatch - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/codecpatch.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/codecpatch.service"
|
||||||
|
|
||||||
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "/usr/bin/codecpatch.sh -r" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "rm -f /usr/bin/codecpatch.sh" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
fi
|
19
codecpatch/manifest.yml
Executable file
19
codecpatch/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: codecpatch
|
||||||
|
description: "Patch Synocodectool (Don't use with Arc Patch)"
|
||||||
|
system: false
|
||||||
|
beta: true
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
181
compile-addons.sh
Executable file
181
compile-addons.sh
Executable file
@ -0,0 +1,181 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TMP_PATH="/tmp"
|
||||||
|
YQ_BIN="$(dirname $0)/yq"
|
||||||
|
TOOLKIT_VER="7.1"
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# 1 - Path of key
|
||||||
|
function hasConfigKey() {
|
||||||
|
[ "$(${YQ_BIN} eval '.'${1}' | has("'${2}'")' "${3}")" == "true" ] && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Read key value from yaml config file
|
||||||
|
# 1 - Path of key
|
||||||
|
# 2 - Path of yaml config file
|
||||||
|
# Return Value
|
||||||
|
function readConfigKey() {
|
||||||
|
RESULT=$(${YQ_BIN} eval '.'${1}' | explode(.)' "${2}")
|
||||||
|
[ "${RESULT}" == "null" ] && echo "" || echo ${RESULT}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Read Entries as array from yaml config file
|
||||||
|
# 1 - Path of key
|
||||||
|
# 2 - Path of yaml config file
|
||||||
|
# Returns array of values
|
||||||
|
function readConfigEntriesArray() {
|
||||||
|
${YQ_BIN} eval '.'${1}' | explode(.) | to_entries | map([.key])[] | .[]' "${2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
function compile-addon() {
|
||||||
|
# Read manifest file
|
||||||
|
MANIFEST="${1}/manifest.yml"
|
||||||
|
if [ ! -f "${MANIFEST}" ]; then
|
||||||
|
echo -e "\033[1;44mWarning: ${MANIFEST} not found, ignoring it\033[0m"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo -e "\033[7mProcessing manifest ${MANIFEST}\033[0m"
|
||||||
|
OUT_PATH="${TMP_PATH}/${1}"
|
||||||
|
rm -rf "${OUT_PATH}"
|
||||||
|
mkdir -p "${OUT_PATH}"
|
||||||
|
VER=$(readConfigKey "version" "${MANIFEST}")
|
||||||
|
# Check manifest version
|
||||||
|
if [ ${VER} -ne 1 ]; then
|
||||||
|
echo -e "\033[1;44mWarning: version ${VER} of manifest not suported, ignoring it\033[0m"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Check if has compile script
|
||||||
|
COMPILESCRIPT=$(readConfigKey "compile-script" "${MANIFEST}")
|
||||||
|
if [ -n "${COMPILESCRIPT}" ]; then
|
||||||
|
echo "Running compile script"
|
||||||
|
pushd . >/dev/null
|
||||||
|
cd "${1}"
|
||||||
|
./${COMPILESCRIPT}
|
||||||
|
popd >/dev/null
|
||||||
|
fi
|
||||||
|
# Copy manifest to destiny
|
||||||
|
cp "${MANIFEST}" "${OUT_PATH}"
|
||||||
|
# Check if exist files for all platforms
|
||||||
|
if hasConfigKey "" "all" "${MANIFEST}"; then
|
||||||
|
echo -e "\033[1;32m Processing 'all' section\033[0m"
|
||||||
|
HAS_FILES=0
|
||||||
|
# Get name of script to install, if defined. This script has low priority
|
||||||
|
INSTALL_SCRIPT="$(readConfigKey "all.install-script" "${MANIFEST}")"
|
||||||
|
if [ -n "${INSTALL_SCRIPT}" ]; then
|
||||||
|
if [ -f "${1}/${INSTALL_SCRIPT}" ]; then
|
||||||
|
echo -e "\033[1;35m Copying install script ${INSTALL_SCRIPT}\033[0m"
|
||||||
|
mkdir -p "${OUT_PATH}/all"
|
||||||
|
cp "${1}/${INSTALL_SCRIPT}" "${OUT_PATH}/all/install.sh"
|
||||||
|
HAS_FILES=1
|
||||||
|
else
|
||||||
|
echo -e "\033[1;33m WARNING: install script '${INSTALL_SCRIPT}' not found\033[0m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Get folder name for copy
|
||||||
|
COPY_PATH="$(readConfigKey "all.copy" "${MANIFEST}")"
|
||||||
|
# If folder exists, copy
|
||||||
|
if [ -n "${COPY_PATH}" ]; then
|
||||||
|
if [ -d "${1}/${COPY_PATH}" ]; then
|
||||||
|
echo -e "\033[1;35m Copying folder '${COPY_PATH}'\033[0m"
|
||||||
|
mkdir -p "${OUT_PATH}/all/root"
|
||||||
|
cp -R "${1}/${COPY_PATH}/"* "${OUT_PATH}/all/root"
|
||||||
|
HAS_FILES=1
|
||||||
|
else
|
||||||
|
echo -e "\033[1;33m WARNING: folder '${COPY_PATH}' not found\033[0m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${HAS_FILES} -eq 1 ]; then
|
||||||
|
# Create tar gziped
|
||||||
|
tar caf "${OUT_PATH}/all.tgz" -C "${OUT_PATH}/all" .
|
||||||
|
echo -e "\033[1;36m Created file '${OUT_PATH}/all.tgz' \033[0m"
|
||||||
|
fi
|
||||||
|
# Clean
|
||||||
|
rm -rf "${OUT_PATH}/all"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now check files for individual models
|
||||||
|
unset AVAL_FOR
|
||||||
|
declare -a AVAL_FOR
|
||||||
|
for P in $(readConfigEntriesArray "available-for" "${MANIFEST}"); do
|
||||||
|
AVAL_FOR+=(${P})
|
||||||
|
done
|
||||||
|
|
||||||
|
# Loop in each available platform-kver
|
||||||
|
for P in ${AVAL_FOR[@]}; do
|
||||||
|
echo -e "\033[1;32m Processing '${P}' platform-kver section\033[0m"
|
||||||
|
HAS_FILES=0
|
||||||
|
# Get name of script to install, if defined. This script has high priority
|
||||||
|
INSTALL_SCRIPT="$(readConfigKey 'available-for."'${P}'".install-script' "${MANIFEST}")"
|
||||||
|
if [ -n "${INSTALL_SCRIPT}" ]; then
|
||||||
|
if [ -f "${1}/${INSTALL_SCRIPT}" ]; then
|
||||||
|
echo -e "\033[1;35m Copying install script ${INSTALL_SCRIPT}\033[0m"
|
||||||
|
mkdir -p "${OUT_PATH}/${P}"
|
||||||
|
cp "${1}/${INSTALL_SCRIPT}" "${OUT_PATH}/${P}/install.sh"
|
||||||
|
HAS_FILES=1
|
||||||
|
else
|
||||||
|
echo -e "\033[1;33m WARNING: install script '${INSTALL_SCRIPT}' not found\033[0m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Get folder name for copy
|
||||||
|
COPY_PATH="$(readConfigKey 'available-for."'${P}'".copy' "${MANIFEST}")"
|
||||||
|
# If folder exists, copy
|
||||||
|
if [ -n "${COPY_PATH}" ]; then
|
||||||
|
if [ -d "${1}/${COPY_PATH}" ]; then
|
||||||
|
echo -e "\033[1;35m Copying folder '${COPY_PATH}'\033[0m"
|
||||||
|
mkdir -p "${OUT_PATH}/${P}/root"
|
||||||
|
cp -R "${1}/${COPY_PATH}/"* "${OUT_PATH}/${P}/root"
|
||||||
|
HAS_FILES=1
|
||||||
|
else
|
||||||
|
echo -e "\033[1;33m WARNING: folder '${1}/${COPY_PATH}' not found\033[0m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
HAS_MODULES="$(readConfigKey 'available-for."'${P}'".modules' "${MANIFEST}")"
|
||||||
|
# Check if has modules for compile
|
||||||
|
if [ "${HAS_MODULES}" = "true" ]; then
|
||||||
|
echo "Compiling modules"
|
||||||
|
PLATFORM="$(echo ${P} | cut -d'-' -f1)"
|
||||||
|
KVER="$(echo ${P} | cut -d'-' -f2)"
|
||||||
|
# Compile using docker
|
||||||
|
rm -rf "${TMP_PATH}/${1}-mods"
|
||||||
|
mkdir -p "${TMP_PATH}/${1}-mods"
|
||||||
|
# docker run --rm -t -v "${TMP_PATH}/${1}-mods":/output \
|
||||||
|
# -v "${PWD}/${1}/src/${KVER}":/input fbelavenuto/syno-toolkit:${PLATFORM}-${TOOLKIT_VER} compile-module
|
||||||
|
docker run --rm -t --user $(id -u) -v "${TMP_PATH}/${1}-mods":/output \
|
||||||
|
-v "${PWD}/${1}/src/${KVER}":/input fbelavenuto/syno-compiler:${TOOLKIT_VER} compile-module ${PLATFORM}
|
||||||
|
mkdir -p "${OUT_PATH}/${P}/root/modules"
|
||||||
|
mv "${TMP_PATH}/${1}-mods/"*.ko "${OUT_PATH}/${P}/root/modules/"
|
||||||
|
rm -rf "${TMP_PATH}/${1}-mods"
|
||||||
|
HAS_FILES=1
|
||||||
|
fi
|
||||||
|
if [ ${HAS_FILES} -eq 1 ]; then
|
||||||
|
# Create tar gziped
|
||||||
|
tar caf "${OUT_PATH}/${P}.tgz" -C "${OUT_PATH}/${P}" .
|
||||||
|
echo -e "\033[1;36m Created file '${P}.tgz' \033[0m"
|
||||||
|
fi
|
||||||
|
# Clean
|
||||||
|
rm -rf "${OUT_PATH}/${P}"
|
||||||
|
done
|
||||||
|
# Create addon package
|
||||||
|
tar caf "${1}.addon" -C "${OUT_PATH}" .
|
||||||
|
rm -rf "${OUT_PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main
|
||||||
|
if [ $# -ge 1 ]; then
|
||||||
|
for A in $@; do
|
||||||
|
compile-addon ${A%/}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while read -r D; do
|
||||||
|
DRIVER=$(basename ${D})
|
||||||
|
[ "${DRIVER:0:1}" = "." ] && continue
|
||||||
|
compile-addon ${DRIVER}
|
||||||
|
done < <(find -maxdepth 1 -type d)
|
||||||
|
fi
|
||||||
|
wait
|
BIN
console/all/addons/console-7.1.tar
Normal file
BIN
console/all/addons/console-7.1.tar
Normal file
Binary file not shown.
102
console/install.sh
Executable file
102
console/install.sh
Executable file
@ -0,0 +1,102 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
PLATFORMS="apollolake geminilake epyc7002"
|
||||||
|
PLATFORM="$(/bin/get_key_value /etc.defaults/synoinfo.conf unique | cut -d"_" -f2)"
|
||||||
|
if ! echo "${PLATFORM}" | grep -qw "${PLATFORM}"; then
|
||||||
|
echo "${PLATFORM} is not supported console addon!"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1}" = "early" ]; then
|
||||||
|
echo "Installing addon console - ${1}"
|
||||||
|
tar zxf /addons/console-7.1.tgz -C /usr/
|
||||||
|
|
||||||
|
elif [ "${1}" = "modules" ]; then
|
||||||
|
echo "Installing addon console - ${1}"
|
||||||
|
if [ -n "${2}" ]; then
|
||||||
|
/usr/sbin/modprobe ${2}
|
||||||
|
else
|
||||||
|
for M in i915 efifb vesafb vga16fb; do
|
||||||
|
[ -e /sys/class/graphics/fb0 ] && break
|
||||||
|
/usr/sbin/modprobe ${M}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
/usr/sbin/modprobe fb
|
||||||
|
/usr/sbin/modprobe fbcon
|
||||||
|
echo "Arc console - wait..." >/dev/tty1
|
||||||
|
# Workaround for DVA1622
|
||||||
|
if [ "${MODEL}" = "DVA1622" ]; then
|
||||||
|
echo >/dev/tty2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 1
|
||||||
|
fi
|
||||||
|
elif [ "${1}" = "rcExit" ]; then
|
||||||
|
# echo "Installing addon console - ${1}"
|
||||||
|
# Run only in junior mode (DSM not installed)
|
||||||
|
echo -e "Junior mode\n" >/etc/issue
|
||||||
|
echo "Starting getty..."
|
||||||
|
/usr/sbin/getty -L 0 tty1 &
|
||||||
|
/usr/bin/loadkeys /usr/share/keymaps/i386/${LAYOUT:-qwerty}/${KEYMAP:-us}.map.gz
|
||||||
|
# Workaround for DVA1622
|
||||||
|
if [ "${MODEL}" = "DVA1622" ]; then
|
||||||
|
echo >/dev/tty2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 1
|
||||||
|
fi
|
||||||
|
elif [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon console - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
tar zxf /addons/console-7.1.tgz -C /tmpRoot/usr/
|
||||||
|
# run when boot installed DSM
|
||||||
|
echo -e "DSM mode\n" >/tmpRoot/etc/issue
|
||||||
|
cp -fv /tmpRoot/usr/lib/systemd/system/serial-getty\@.service /tmpRoot/usr/lib/systemd/system/getty\@.service
|
||||||
|
sed -i 's|^ExecStart=.*|ExecStart=-/sbin/agetty %I 115200 linux|' /tmpRoot/usr/lib/systemd/system/getty\@.service
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/getty.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/getty\@.service /tmpRoot/usr/lib/systemd/system/getty.target.wants/getty\@tty1.service
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/keymap.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Configure keymap" >>${DEST}
|
||||||
|
echo "After=getty.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/loadkeys /usr/share/keymaps/i386/${LAYOUT:-qwerty}/${KEYMAP:-us}.map.gz" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/keymap.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/keymap.service
|
||||||
|
# Workaround for DVA1622
|
||||||
|
if [ "${MODEL}" = "DVA1622" ]; then
|
||||||
|
echo >/dev/tty2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 2
|
||||||
|
/usr/bin/ioctl /dev/tty0 22022 -v 1
|
||||||
|
fi
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon console - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/getty.target.wants/getty\@tty1.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/getty\@.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/keymap.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/keymap.service"
|
||||||
|
|
||||||
|
rm -rf /tmpRoot/usr/share/consolefonts
|
||||||
|
rm -rf /tmpRoot/usr/share/keymaps
|
||||||
|
rm -f /tmpRoot/usr/bin/chvt
|
||||||
|
rm -f /tmpRoot/usr/bin/deallocvt
|
||||||
|
rm -f /tmpRoot/usr/bin/loadkeys
|
||||||
|
rm -f /tmpRoot/usr/bin/setleds
|
||||||
|
rm -f /tmpRoot/usr/bin/ioctl
|
||||||
|
fi
|
19
console/manifest.yml
Executable file
19
console/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: console
|
||||||
|
description: "Give a onscreen console via framebuffer"
|
||||||
|
system: false
|
||||||
|
beta: true
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: false
|
||||||
|
broadwellnk: false
|
||||||
|
broadwellnkv2: false
|
||||||
|
broadwellntbap: false
|
||||||
|
denverton: false
|
||||||
|
geminilake: true
|
||||||
|
purley: false
|
||||||
|
v1000: false
|
||||||
|
r1000: false
|
||||||
|
epyc7002: true
|
21
cpufreqscaling/all/usr/sbin/rescaler.sh
Executable file
21
cpufreqscaling/all/usr/sbin/rescaler.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Make things safer
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
rm -f /usr/sbin/stopscale
|
||||||
|
|
||||||
|
systemctl enable cpufreqscaling.service
|
||||||
|
systemctl start cpufreqscaling.service
|
||||||
|
|
||||||
|
# Get cpu cores count minus 1, to allow maping from 0
|
||||||
|
cpucorecount=$(cat /proc/cpuinfo | grep processor | wc -l)
|
||||||
|
cpucorecount=$((cpucorecount - 1))
|
||||||
|
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
|
|
||||||
|
# Set correct cpufreq governor to allow user defined frequency scaling
|
||||||
|
if [ "$governor" != "userspace" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
echo "userspace" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_governor
|
||||||
|
done
|
||||||
|
fi
|
122
cpufreqscaling/all/usr/sbin/scaler.sh
Executable file
122
cpufreqscaling/all/usr/sbin/scaler.sh
Executable file
@ -0,0 +1,122 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Make things safer
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Ensure root user
|
||||||
|
#if [ "$EUID" -ne 0 ]; then
|
||||||
|
# echo "Please run as root"
|
||||||
|
# exit
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Ensure acpi-cpufreq kernel module is loaded
|
||||||
|
#if ! modprobe acpi-cpufreq; then
|
||||||
|
# pushd /lib/modules
|
||||||
|
# insmod acpi-cpufreq.ko
|
||||||
|
# popd
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Frequency scaling function
|
||||||
|
function main {
|
||||||
|
|
||||||
|
if [ $(cat /proc/cpuinfo |grep Intel |wc -l) -gt 0 ]; then
|
||||||
|
CPU="INTEL"
|
||||||
|
else
|
||||||
|
CPU="AMD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get cpu cores count minus 1, to allow maping from 0
|
||||||
|
cpucorecount=$(cat /proc/cpuinfo | grep processor | wc -l)
|
||||||
|
cpucorecount=$((cpucorecount - 1))
|
||||||
|
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
|
|
||||||
|
# Rereive allowed cpu freq on the system
|
||||||
|
IFS=" " read -r -a freqlist <<<"$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies)"
|
||||||
|
|
||||||
|
# Set min and max frequencies, this user overidable
|
||||||
|
scalingminfreq=${scalingminfreq:=${freqlist[-1]}}
|
||||||
|
scalingmaxfreq=${scalingmaxfreq:=${freqlist[0]}}
|
||||||
|
|
||||||
|
# This will set user defined min and max frequencies
|
||||||
|
if [ "$governor" = "userspace" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
echo "$scalingminfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_min_freq
|
||||||
|
echo "$scalingmaxfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_max_freq
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CPU" = "INTEL" ]; then
|
||||||
|
# Get current and max cpu temps for Intel
|
||||||
|
currtemp=$(cat /sys/bus/platform/devices/coretemp.0/hwmon/hwmon0/temp1_input)
|
||||||
|
maxtemp=$(cat /sys/bus/platform/devices/coretemp.0/hwmon/hwmon0/temp1_max)
|
||||||
|
|
||||||
|
# Frequencies steps definitions (only for Intel)
|
||||||
|
coolfreq=${freqlist[3]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Frequencies steps definitions
|
||||||
|
minfreq=${freqlist[-1]}
|
||||||
|
midfreq=${freqlist[$((${#freqlist[*]} / 2))]}
|
||||||
|
maxfreq=${freqlist[0]}
|
||||||
|
|
||||||
|
# Get average load over 5m in base10 integer format
|
||||||
|
loadavg=$(awk -F . '{print $1 substr($2,1,2)}' </proc/loadavg)
|
||||||
|
|
||||||
|
# Set load steps to trigger frequencies scaling, this user overidable
|
||||||
|
lowload=$(grep cores /proc/cpuinfo | sort -u | awk '{ print $4 * 0.3 * 100 }')
|
||||||
|
midload=$(grep cores /proc/cpuinfo | sort -u | awk '{ print $4 * 0.6 * 100 }')
|
||||||
|
|
||||||
|
if [ "$CPU" = "INTEL" ]; then
|
||||||
|
if [ "$currtemp" -lt "$maxtemp" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
if [ "$loadavg" -le $((10#$lowload)) ]; then
|
||||||
|
echo "$minfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
elif [ "$loadavg" -ge $((10#$lowload)) ] && [ "$loadavg" -le $((10#$midload)) ]; then
|
||||||
|
echo "$midfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
elif [ "$loadavg" -ge $((10#$midload)) ]; then
|
||||||
|
echo "$maxfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
echo "$coolfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
done
|
||||||
|
sleep 30
|
||||||
|
fi
|
||||||
|
elif [ "$CPU" = "AMD" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
if [ "$loadavg" -le $((10#$lowload)) ]; then
|
||||||
|
echo "$minfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
elif [ "$loadavg" -ge $((10#$lowload)) ] && [ "$loadavg" -le $((10#$midload)) ]; then
|
||||||
|
echo "$midfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
elif [ "$loadavg" -ge $((10#$midload)) ]; then
|
||||||
|
echo "$maxfreq" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_setspeed
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Deamonize the main function...
|
||||||
|
while true; do
|
||||||
|
|
||||||
|
if [ -f /usr/sbin/stopscale ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Get cpu cores count minus 1, to allow maping from 0
|
||||||
|
cpucorecount=$(cat /proc/cpuinfo | grep processor | wc -l)
|
||||||
|
cpucorecount=$((cpucorecount - 1))
|
||||||
|
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
|
|
||||||
|
# Set correct cpufreq governor to allow user defined frequency scaling
|
||||||
|
if [ "$governor" != "userspace" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
echo "userspace" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_governor
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
|
if [ "$governor" = "userspace" ]; then
|
||||||
|
main
|
||||||
|
fi
|
||||||
|
sleep 0.5
|
||||||
|
done
|
21
cpufreqscaling/all/usr/sbin/unscaler.sh
Executable file
21
cpufreqscaling/all/usr/sbin/unscaler.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Make things safer
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
systemctl stop cpufreq-userspace-scaler.service
|
||||||
|
systemctl disable cpufreq-userspace-scaler.service
|
||||||
|
|
||||||
|
# Get cpu cores count minus 1, to allow maping from 0
|
||||||
|
cpucorecount=$(cat /proc/cpuinfo | grep processor | wc -l)
|
||||||
|
cpucorecount=$((cpucorecount - 1))
|
||||||
|
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
|
|
||||||
|
# Set correct cpufreq governor to allow user defined frequency scaling
|
||||||
|
if [ "$governor" != "performance" ]; then
|
||||||
|
for i in $(seq 0 "${cpucorecount}"); do
|
||||||
|
echo "performance" >/sys/devices/system/cpu/cpu"${i}"/cpufreq/scaling_governor
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch /usr/sbin/stopscale
|
46
cpufreqscaling/install.sh
Executable file
46
cpufreqscaling/install.sh
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing cpufreqscalingscaling - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/sbin/scaler.sh /tmpRoot/usr/sbin/scaler.sh
|
||||||
|
cp -vf /usr/sbin/unscaler.sh /tmpRoot/usr/sbin/unscaler.sh
|
||||||
|
cp -vf /usr/sbin/rescaler.sh /tmpRoot/usr/sbin/rescaler.sh
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/cpufreqscaling.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Enable CPU Freq scaling" >>${DEST}
|
||||||
|
echo "DefaultDependencies=no" >>${DEST}
|
||||||
|
echo "IgnoreOnIsolate=true" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "User=root" >>${DEST}
|
||||||
|
echo "Restart=always" >>${DEST}
|
||||||
|
echo "RestartSec=30" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/sbin/scaler.sh" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[X-Synology]" >>${DEST}
|
||||||
|
echo "Author=Virtualization Team" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/cpufreqscaling.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpufreqscaling.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing cpufreqscalingscaling - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpufreqscaling.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/cpufreqscaling.service"
|
||||||
|
|
||||||
|
rm -f /tmpRoot/usr/sbin/scaler.sh
|
||||||
|
rm -f /tmpRoot/usr/sbin/rescaler.sh
|
||||||
|
rm -f /tmpRoot/usr/sbin/unscaler.sh
|
||||||
|
fi
|
19
cpufreqscaling/manifest.yml
Normal file
19
cpufreqscaling/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: cpufreqscaling
|
||||||
|
description: "Enable CPU Freqscaling for DSM"
|
||||||
|
system: false
|
||||||
|
beta: true
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
126
cpuinfo/all/usr/bin/cpuinfo.sh
Executable file
126
cpuinfo/all/usr/bin/cpuinfo.sh
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
VENDOR=""
|
||||||
|
FAMILY=""
|
||||||
|
SERIES="$(echo $(grep 'model name' /proc/cpuinfo 2>/dev/null | head -1 | cut -d: -f2))"
|
||||||
|
CORES="$(grep 'cpu cores' /proc/cpuinfo 2>/dev/null | wc -l)"
|
||||||
|
if [ -z ${CORES} ]; then
|
||||||
|
CORES="$(dmidecode -t processor | grep "Core Count" | head -1 | cut -d: -f2)"
|
||||||
|
fi
|
||||||
|
SPEED="$(grep 'cpu MHz' /proc/cpuinfo 2>/dev/null | head -1 | cut -d: -f2)"
|
||||||
|
SPEED="${SPEED%.*}"
|
||||||
|
if [ -z ${SPEED} || ${SPEED} -eq 800 ]; then
|
||||||
|
SPEED="$(dmidecode -t processor | grep "Max Speed" | head -1 | cut -d: -f2 | cut -d ' ' -f2)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE_JS="/usr/syno/synoman/webman/modules/AdminCenter/admin_center.js"
|
||||||
|
FILE_GZ="${FILE_JS}.gz"
|
||||||
|
|
||||||
|
[ ! -f "${FILE_JS}" -a ! -f "${FILE_GZ}" ] && echo "File ${FILE_JS} does not exist" && exit 0
|
||||||
|
|
||||||
|
restoreCpuinfo() {
|
||||||
|
if [ -f "${FILE_GZ}.bak" ]; then
|
||||||
|
rm -f "${FILE_JS}" "${FILE_GZ}"
|
||||||
|
mv -f "${FILE_GZ}.bak" "${FILE_GZ}"
|
||||||
|
gzip -dc "${FILE_GZ}" >"${FILE_JS}"
|
||||||
|
chmod a+r "${FILE_JS}" "${FILE_GZ}"
|
||||||
|
elif [ -f "${FILE_JS}.bak" ]; then
|
||||||
|
mv -f "${FILE_JS}.bak" "${FILE_JS}"
|
||||||
|
chmod a+r "${FILE_JS}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if options="$(getopt -o v:f:s:c:p:rh --long vendor:,family:,series:,cores:,speed:,restore,help -- "$@")"; then
|
||||||
|
eval set -- "$options"
|
||||||
|
while true; do
|
||||||
|
case "${1,,}" in
|
||||||
|
-v | --vendor)
|
||||||
|
VENDOR="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-f | --family)
|
||||||
|
FAMILY="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-s | --series)
|
||||||
|
SERIES="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-c | --cores)
|
||||||
|
CORES="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-p | --speed)
|
||||||
|
SPEED="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-r | --restore)
|
||||||
|
restoreCpuinfo
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-h | --help)
|
||||||
|
echo "Usage: cpuinfo.sh [OPTIONS]"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -v, --vendor <VENDOR> Set the CPU vendor"
|
||||||
|
echo " -f, --family <FAMILY> Set the CPU family"
|
||||||
|
echo " -s, --series <SERIES> Set the CPU series"
|
||||||
|
echo " -c, --cores <CORES> Set the number of CPU cores"
|
||||||
|
echo " -p, --speed <SPEED> Set the CPU clock speed"
|
||||||
|
echo " -r, --restore Restore the original cpuinfo"
|
||||||
|
echo " -h, --help Show this help message and exit"
|
||||||
|
echo "Example:"
|
||||||
|
echo " cpuinfo.sh -v \"AMD\" -f \"Ryzen\" -s \"Ryzen 7 5800X3D\" -c 64 -p 5200"
|
||||||
|
echo " cpuinfo.sh --vendor \"Intel\" --family \"Core i9\" --series \"i7-13900ks\" --cores 64 --speed 5200"
|
||||||
|
echo " cpuinfo.sh --restore"
|
||||||
|
echo " cpuinfo.sh --help"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid option: $OPTARG" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "getopt error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CORES="${CORES:-1}"
|
||||||
|
SPEED="${SPEED:-0}"
|
||||||
|
|
||||||
|
if [ -f "${FILE_GZ}" ]; then
|
||||||
|
[ ! -f "${FILE_GZ}.bak" ] && cp -f "${FILE_GZ}" "${FILE_GZ}.bak" && chmod a+r "${FILE_GZ}.bak"
|
||||||
|
else
|
||||||
|
[ ! -f "${FILE_JS}.bak" ] && cp -f "${FILE_JS}" "${FILE_JS}.bak" && chmod a+r "${FILE_JS}.bak"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "${FILE_JS}"
|
||||||
|
if [ -f "${FILE_GZ}.bak" ]; then
|
||||||
|
gzip -dc "${FILE_GZ}.bak" >"${FILE_JS}"
|
||||||
|
else
|
||||||
|
cp -f "${FILE_JS}.bak" "${FILE_JS}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "CPU Info set to: \"${VENDOR}\" \"${FAMILY}\" \"${SERIES}\" \"${CORES}\" \"${SPEED}\""
|
||||||
|
|
||||||
|
sed -i "s/\(\(,\)\|\((\)\).\.cpu_vendor/\1\"${VENDOR//\"/}\"/g" "${FILE_JS}"
|
||||||
|
sed -i "s/\(\(,\)\|\((\)\).\.cpu_family/\1\"${FAMILY//\"/}\"/g" "${FILE_JS}"
|
||||||
|
sed -i "s/\(\(,\)\|\((\)\).\.cpu_series/\1\"${SERIES//\"/}\"/g" "${FILE_JS}"
|
||||||
|
sed -i "s/\(\(,\)\|\((\)\).\.cpu_cores/\1\"${CORES//\"/}\"/g" "${FILE_JS}"
|
||||||
|
sed -i "s/\(\(,\)\|\((\)\).\.cpu_clock_speed/\1${SPEED//\"/}/g" "${FILE_JS}"
|
||||||
|
|
||||||
|
if [ -f "${FILE_GZ}.bak" ]; then
|
||||||
|
gzip -c "${FILE_JS}" >"${FILE_GZ}"
|
||||||
|
chmod a+r "${FILE_GZ}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
42
cpuinfo/install.sh
Executable file
42
cpuinfo/install.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon cpuinfo - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/cpuinfo.sh /tmpRoot/usr/bin/cpuinfo.sh
|
||||||
|
|
||||||
|
shift
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/cpuinfo.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Adds correct CPU Info" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/cpuinfo.sh $@" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/cpuinfo.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpuinfo.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon cpuinfo - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpuinfo.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/cpuinfo.service"
|
||||||
|
|
||||||
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "/usr/bin/cpuinfo.sh -r" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "rm -f /usr/bin/cpuinfo.sh" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
fi
|
19
cpuinfo/manifest.yml
Executable file
19
cpuinfo/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: cpuinfo
|
||||||
|
description: "Adds correct CPU Info to DSM"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
63
dbgutils/install.sh
Executable file
63
dbgutils/install.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
function getlog() {
|
||||||
|
[ -z "${1}" ] && echo "Usage: ${0} {early|jrExit|rcExit|late|dsm}" && exit 1
|
||||||
|
|
||||||
|
WORK_PATH="/mnt/p1"
|
||||||
|
mkdir -p "${WORK_PATH}"
|
||||||
|
|
||||||
|
if ! mount | grep -q "${WORK_PATH}"; then
|
||||||
|
LOADER_DISK_PART1="$(blkid -L ARC1)"
|
||||||
|
[ -z "${LOADER_DISK_PART1}" -a -b "/dev/synoboot1" ] && LOADER_DISK_PART1="/dev/synoboot1"
|
||||||
|
[ -z "${LOADER_DISK_PART1}" ] && echo "Boot disk not found" && exit 1
|
||||||
|
|
||||||
|
modprobe vfat
|
||||||
|
echo 1 >/proc/sys/kernel/syno_install_flag
|
||||||
|
mount "${LOADER_DISK_PART1}" "${WORK_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEST_PATH="${WORK_PATH}/logs/${1}"
|
||||||
|
rm -rf "${DEST_PATH}"
|
||||||
|
mkdir -p "${DEST_PATH}"
|
||||||
|
|
||||||
|
dmesg >"${DEST_PATH}/dmesg.log"
|
||||||
|
lsmod >"${DEST_PATH}/lsmod.log"
|
||||||
|
lspci -Qnnk >"${DEST_PATH}/lspci.log" || true
|
||||||
|
|
||||||
|
ls -l /sys/class/net/*/device/driver >"${DEST_PATH}/net-driver.log" || true
|
||||||
|
|
||||||
|
ls -l /sys/class/block >"${DEST_PATH}/disk-block.log" || true
|
||||||
|
ls -l /sys/class/scsi_host >"${DEST_PATH}/disk-scsi_host.log" || true
|
||||||
|
cat /sys/block/*/device/syno_block_info >"${DEST_PATH}/disk-syno_block_info.log" || true
|
||||||
|
|
||||||
|
[ -f "/addons/addons.sh" ] && cp -f "/addons/addons.sh" "${DEST_PATH}/addons.sh" || true
|
||||||
|
[ -f "/addons/model.dts" ] && cp -f "/addons/model.dts" "${DEST_PATH}/model.dts" || true
|
||||||
|
|
||||||
|
[ -f "/var/log/messages" ] && cp -f "/var/log/messages" "${DEST_PATH}/messages" || true
|
||||||
|
[ -f "/var/log/linuxrc.syno.log" ] && cp -f "/var/log/linuxrc.syno.log" "${DEST_PATH}/linuxrc.syno.log" || true
|
||||||
|
[ -f "/tmp/installer_sh.log" ] && cp -f "/tmp/installer_sh.log" "${DEST_PATH}/installer_sh.log" || true
|
||||||
|
|
||||||
|
sync
|
||||||
|
umount "${WORK_PATH}"
|
||||||
|
rm -rf "${WORK_PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "${1}" = "early" ]; then
|
||||||
|
echo "Installing addon dbgutils - ${1}"
|
||||||
|
getlog "${1}"
|
||||||
|
elif [ "${1}" = "jrExit" ]; then
|
||||||
|
echo "Installing addon dbgutils - ${1}"
|
||||||
|
getlog "${1}"
|
||||||
|
elif [ "${1}" = "rcExit" ]; then
|
||||||
|
echo "Installing addon dbgutils - ${1}"
|
||||||
|
getlog "${1}"
|
||||||
|
elif [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon dbgutils - ${1}"
|
||||||
|
getlog "${1}"
|
||||||
|
fi
|
19
dbgutils/manifest.yml
Executable file
19
dbgutils/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: dbgutils
|
||||||
|
description: "Binaries to facilitate debug in the junior mode"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
982
deduplication/all/usr/bin/deduplication.sh
Executable file
982
deduplication/all/usr/bin/deduplication.sh
Executable file
@ -0,0 +1,982 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Enables data deduplication with non-Synology drives and unsupported NAS models
|
||||||
|
#
|
||||||
|
# Github: https://github.com/007revad/Synology_enable_Deduplication
|
||||||
|
# Script verified at https://www.shellcheck.net/
|
||||||
|
#
|
||||||
|
# To run in a shell (replace /volume1/scripts/ with path to script):
|
||||||
|
# sudo /volume1/scripts/syno_enable_dedupe.sh
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
scriptver="v1.3.25"
|
||||||
|
script=Synology_enable_Deduplication
|
||||||
|
repo="007revad/Synology_enable_Deduplication"
|
||||||
|
scriptname=syno_enable_dedupe
|
||||||
|
|
||||||
|
# Check BASH variable is bash
|
||||||
|
if [ ! "$(basename "$BASH")" = bash ]; then
|
||||||
|
echo "This is a bash script. Do not run it with $(basename "$BASH")"
|
||||||
|
printf \\a
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check script is running on a Synology NAS
|
||||||
|
if ! /usr/bin/uname -a | grep -i synology >/dev/null; then
|
||||||
|
echo "This script is NOT running on a Synology NAS!"
|
||||||
|
echo "Copy the script to a folder on the Synology"
|
||||||
|
echo "and run it from there."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ding(){
|
||||||
|
printf \\a
|
||||||
|
}
|
||||||
|
|
||||||
|
usage(){
|
||||||
|
cat <<EOF
|
||||||
|
$script $scriptver - by 007revad
|
||||||
|
|
||||||
|
Usage: $(basename "$0") [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-c, --check Check value in file and backup file
|
||||||
|
-r, --restore Undo all changes made by the script
|
||||||
|
-t, --tiny Enable tiny data deduplication (only needs 4GB RAM)
|
||||||
|
DSM 7.2.1 and later only
|
||||||
|
--hdd Enable data deduplication for HDDs (dangerous)
|
||||||
|
-e, --email Disable colored text in output for scheduler emails
|
||||||
|
--autoupdate=AGE Auto update script (useful when script is scheduled)
|
||||||
|
AGE is how many days old a release must be before
|
||||||
|
auto-updating. AGE must be a number: 0 or greater
|
||||||
|
-s, --skip Skip memory amount check (for testing)
|
||||||
|
-h, --help Show this help message
|
||||||
|
-v, --version Show the script version
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scriptversion(){
|
||||||
|
cat <<EOF
|
||||||
|
$script $scriptver - by 007revad
|
||||||
|
|
||||||
|
See https://github.com/$repo
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Save options used
|
||||||
|
args=("$@")
|
||||||
|
|
||||||
|
|
||||||
|
autoupdate=""
|
||||||
|
|
||||||
|
# Check for flags with getopt
|
||||||
|
if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -l \
|
||||||
|
skip,check,restore,help,version,tiny,hdd,email,autoupdate:,log,debug -- "$@")"; then
|
||||||
|
eval set -- "$options"
|
||||||
|
while true; do
|
||||||
|
case "${1,,}" in
|
||||||
|
-h|--help) # Show usage options
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-v|--version) # Show script version
|
||||||
|
scriptversion
|
||||||
|
;;
|
||||||
|
-t|--tiny) # Enable tiny deduplication
|
||||||
|
tiny=yes
|
||||||
|
;;
|
||||||
|
--hdd) # Enable deduplication for HDDs (dangerous)
|
||||||
|
hdd=yes
|
||||||
|
;;
|
||||||
|
-s|--skip) # Skip memory amount check (for testing)
|
||||||
|
skip=yes
|
||||||
|
;;
|
||||||
|
-l|--log) # Log
|
||||||
|
#log=yes
|
||||||
|
;;
|
||||||
|
-d|--debug) # Show and log debug info
|
||||||
|
debug=yes
|
||||||
|
;;
|
||||||
|
-c|--check) # Check value in file and backup file
|
||||||
|
check=yes
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-r|--restore) # Restore from backups to undo changes
|
||||||
|
restore=yes
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-e|--email) # Disable colour text in task scheduler emails
|
||||||
|
color=no
|
||||||
|
;;
|
||||||
|
--autoupdate) # Auto update script
|
||||||
|
autoupdate=yes
|
||||||
|
if [[ $2 =~ ^[0-9]+$ ]]; then
|
||||||
|
delay="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
delay="0"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*) # Show usage options
|
||||||
|
echo -e "Invalid option '$1'\n"
|
||||||
|
usage "$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $debug == "yes" ]]; then
|
||||||
|
set -x
|
||||||
|
export PS4='`[[ $? == 0 ]] || echo "\e[1;31;40m($?)\e[m\n "`:.$LINENO:'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Shell Colors
|
||||||
|
if [[ $color != "no" ]]; then
|
||||||
|
#Black='\e[0;30m' # ${Black}
|
||||||
|
Red='\e[0;31m' # ${Red}
|
||||||
|
#Green='\e[0;32m' # ${Green}
|
||||||
|
Yellow='\e[0;33m' # ${Yellow}
|
||||||
|
#Blue='\e[0;34m' # ${Blue}
|
||||||
|
#Purple='\e[0;35m' # ${Purple}
|
||||||
|
Cyan='\e[0;36m' # ${Cyan}
|
||||||
|
#White='\e[0;37m' # ${White}
|
||||||
|
Error='\e[41m' # ${Error}
|
||||||
|
Off='\e[0m' # ${Off}
|
||||||
|
else
|
||||||
|
echo "" # For task scheduler email readability
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check script is running as root
|
||||||
|
if [[ $( whoami ) != "root" ]]; then
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} This script must be run as sudo or root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get DSM major, minor and micro versions
|
||||||
|
major=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION majorversion)
|
||||||
|
minor=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION minorversion)
|
||||||
|
micro=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION micro)
|
||||||
|
|
||||||
|
# Get NAS model
|
||||||
|
model=$(cat /proc/sys/kernel/syno_hw_version)
|
||||||
|
#modelname="$model"
|
||||||
|
|
||||||
|
|
||||||
|
# Show script version
|
||||||
|
#echo -e "$script $scriptver\ngithub.com/$repo\n"
|
||||||
|
echo "$script $scriptver"
|
||||||
|
|
||||||
|
# Get DSM full version
|
||||||
|
productversion=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION productversion)
|
||||||
|
buildphase=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildphase)
|
||||||
|
buildnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildnumber)
|
||||||
|
smallfixnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION smallfixnumber)
|
||||||
|
|
||||||
|
# Show DSM full version and model
|
||||||
|
if [[ $buildphase == GM ]]; then buildphase=""; fi
|
||||||
|
if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi
|
||||||
|
echo -e "$model DSM $productversion-$buildnumber$smallfix $buildphase\n"
|
||||||
|
|
||||||
|
|
||||||
|
# Get StorageManager version
|
||||||
|
storagemgrver=$(/usr/syno/bin/synopkg version StorageManager)
|
||||||
|
# Show StorageManager version
|
||||||
|
if [[ $storagemgrver ]]; then echo -e "StorageManager $storagemgrver \n"; fi
|
||||||
|
|
||||||
|
|
||||||
|
# Show options used
|
||||||
|
if [[ ${#args[@]} -gt "0" ]]; then
|
||||||
|
#echo -e "Using options: ${args[*]}\n"
|
||||||
|
echo -e "Using options: ${args[*]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $major$minor$micro -lt "701" ]]; then
|
||||||
|
ding
|
||||||
|
#echo "This script only works for DSM 7.0.1 and later."
|
||||||
|
echo "Btrfs Data Deduplication only works in DSM 7.0.1 and later."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check model (and DSM version for that model) supports dedupe
|
||||||
|
if [[ ! -f /usr/syno/sbin/synobtrfsdedupe ]]; then
|
||||||
|
arch=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/synoinfo.conf platform_name)
|
||||||
|
#echo "Your model or DSM version does not support Btrfs Data Deduplication."
|
||||||
|
echo "Models with $arch CPUs do not support Btrfs Data Deduplication."
|
||||||
|
echo "Only models with V1000, R1000, Geminilake, Broadwellnkv2, "
|
||||||
|
echo "Broadwellnk, Broadwell, Purley and Epyc7002 CPUs are supported."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Check latest release with GitHub API
|
||||||
|
|
||||||
|
syslog_set(){
|
||||||
|
if [[ ${1,,} == "info" ]] || [[ ${1,,} == "warn" ]] || [[ ${1,,} == "err" ]]; then
|
||||||
|
if [[ $autoupdate == "yes" ]]; then
|
||||||
|
# Add entry to Synology system log
|
||||||
|
/usr/syno/bin/synologset1 sys "$1" 0x11100000 "$2"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get latest release info
|
||||||
|
# Curl timeout options:
|
||||||
|
# https://unix.stackexchange.com/questions/94604/does-curl-have-a-timeout
|
||||||
|
release=$(curl --silent -m 10 --connect-timeout 5 \
|
||||||
|
"https://api.github.com/repos/$repo/releases/latest")
|
||||||
|
|
||||||
|
# Release version
|
||||||
|
tag=$(echo "$release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
shorttag="${tag:1}"
|
||||||
|
|
||||||
|
# Release published date
|
||||||
|
published=$(echo "$release" | grep '"published_at":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
published="${published:0:10}"
|
||||||
|
published=$(date -d "$published" '+%s')
|
||||||
|
|
||||||
|
# Today's date
|
||||||
|
now=$(date '+%s')
|
||||||
|
|
||||||
|
# Days since release published
|
||||||
|
age=$(((now - published)/(60*60*24)))
|
||||||
|
|
||||||
|
|
||||||
|
# Get script location
|
||||||
|
# https://stackoverflow.com/questions/59895/
|
||||||
|
source=${BASH_SOURCE[0]}
|
||||||
|
while [ -L "$source" ]; do # Resolve $source until the file is no longer a symlink
|
||||||
|
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
|
||||||
|
source=$(readlink "$source")
|
||||||
|
# If $source was a relative symlink, we need to resolve it
|
||||||
|
# relative to the path where the symlink file was located
|
||||||
|
[[ $source != /* ]] && source=$scriptpath/$source
|
||||||
|
done
|
||||||
|
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
|
||||||
|
scriptfile=$( basename -- "$source" )
|
||||||
|
echo "Running from: ${scriptpath}/$scriptfile"
|
||||||
|
|
||||||
|
# Warn if script located on M.2 drive
|
||||||
|
scriptvol=$(echo "$scriptpath" | cut -d"/" -f2)
|
||||||
|
vg=$(lvdisplay | grep /volume_"${scriptvol#volume}" | cut -d"/" -f3)
|
||||||
|
md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3)
|
||||||
|
if cat /proc/mdstat | grep "$md" | grep nvme >/dev/null; then
|
||||||
|
echo -e "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cleanup_tmp(){
|
||||||
|
cleanup_err=
|
||||||
|
|
||||||
|
# Delete downloaded .tar.gz file
|
||||||
|
if [[ -f "/tmp/$script-$shorttag.tar.gz" ]]; then
|
||||||
|
if ! rm "/tmp/$script-$shorttag.tar.gz"; then
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to delete"\
|
||||||
|
"downloaded /tmp/$script-$shorttag.tar.gz!" >&2
|
||||||
|
cleanup_err=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete extracted tmp files
|
||||||
|
if [[ -d "/tmp/$script-$shorttag" ]]; then
|
||||||
|
if ! rm -r "/tmp/$script-$shorttag"; then
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to delete"\
|
||||||
|
"downloaded /tmp/$script-$shorttag!" >&2
|
||||||
|
cleanup_err=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add warning to DSM log
|
||||||
|
if [[ -z $cleanup_err ]]; then
|
||||||
|
syslog_set warn "$script update failed to delete tmp files"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ! printf "%s\n%s\n" "$tag" "$scriptver" |
|
||||||
|
sort --check=quiet --version-sort >/dev/null ; then
|
||||||
|
echo -e "\n${Cyan}There is a newer version of this script available.${Off}"
|
||||||
|
echo -e "Current version: ${scriptver}\nLatest version: $tag"
|
||||||
|
scriptdl="$scriptpath/$script-$shorttag"
|
||||||
|
if [[ -f ${scriptdl}.tar.gz ]] || [[ -f ${scriptdl}.zip ]]; then
|
||||||
|
# They have the latest version tar.gz downloaded but are using older version
|
||||||
|
echo "You have the latest version downloaded but are using an older version"
|
||||||
|
sleep 10
|
||||||
|
elif [[ -d $scriptdl ]]; then
|
||||||
|
# They have the latest version extracted but are using older version
|
||||||
|
echo "You have the latest version extracted but are using an older version"
|
||||||
|
sleep 10
|
||||||
|
else
|
||||||
|
if [[ $autoupdate == "yes" ]]; then
|
||||||
|
if [[ $age -gt "$delay" ]] || [[ $age -eq "$delay" ]]; then
|
||||||
|
echo "Downloading $tag"
|
||||||
|
reply=y
|
||||||
|
else
|
||||||
|
echo "Skipping as $tag is less than $delay days old."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${Cyan}Do you want to download $tag now?${Off} [y/n]"
|
||||||
|
read -r -t 30 reply
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${reply,,} == "y" ]]; then
|
||||||
|
# Delete previously downloaded .tar.gz file and extracted tmp files
|
||||||
|
cleanup_tmp
|
||||||
|
|
||||||
|
if cd /tmp; then
|
||||||
|
url="https://github.com/$repo/archive/refs/tags/$tag.tar.gz"
|
||||||
|
if ! curl -JLO -m 30 --connect-timeout 5 "$url"; then
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to download"\
|
||||||
|
"$script-$shorttag.tar.gz!"
|
||||||
|
syslog_set warn "$script $tag failed to download"
|
||||||
|
else
|
||||||
|
if [[ -f /tmp/$script-$shorttag.tar.gz ]]; then
|
||||||
|
# Extract tar file to /tmp/<script-name>
|
||||||
|
if ! tar -xf "/tmp/$script-$shorttag.tar.gz" -C "/tmp"; then
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to"\
|
||||||
|
"extract $script-$shorttag.tar.gz!"
|
||||||
|
syslog_set warn "$script failed to extract $script-$shorttag.tar.gz!"
|
||||||
|
else
|
||||||
|
# Set script sh files as executable
|
||||||
|
if ! chmod a+x "/tmp/$script-$shorttag/"*.sh ; then
|
||||||
|
permerr=1
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to set executable permissions"
|
||||||
|
syslog_set warn "$script failed to set permissions on $tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy new script sh file to script location
|
||||||
|
if ! cp -p "/tmp/$script-$shorttag/${scriptname}.sh" "${scriptpath}/${scriptfile}";
|
||||||
|
then
|
||||||
|
copyerr=1
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to copy"\
|
||||||
|
"$script-$shorttag sh file(s) to:\n $scriptpath/${scriptfile}"
|
||||||
|
syslog_set warn "$script failed to copy $tag to script location"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy new CHANGES.txt file to script location (if script on a volume)
|
||||||
|
if [[ $scriptpath =~ /volume* ]]; then
|
||||||
|
# Set permissions on CHANGES.txt
|
||||||
|
if ! chmod 664 "/tmp/$script-$shorttag/CHANGES.txt"; then
|
||||||
|
permerr=1
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to set permissions on:"
|
||||||
|
echo "$scriptpath/CHANGES.txt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy new CHANGES.txt file to script location
|
||||||
|
if ! cp -p "/tmp/$script-$shorttag/CHANGES.txt"\
|
||||||
|
"${scriptpath}/${scriptname}_CHANGES.txt";
|
||||||
|
then
|
||||||
|
if [[ $autoupdate != "yes" ]]; then copyerr=1; fi
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to copy"\
|
||||||
|
"$script-$shorttag/CHANGES.txt to:\n $scriptpath"
|
||||||
|
else
|
||||||
|
changestxt=" and changes.txt"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete downloaded tmp files
|
||||||
|
cleanup_tmp
|
||||||
|
|
||||||
|
# Notify of success (if there were no errors)
|
||||||
|
if [[ $copyerr != 1 ]] && [[ $permerr != 1 ]]; then
|
||||||
|
echo -e "\n$tag ${scriptfile}$changestxt downloaded to: ${scriptpath}\n"
|
||||||
|
syslog_set info "$script successfully updated to $tag"
|
||||||
|
|
||||||
|
# Reload script
|
||||||
|
printf -- '-%.0s' {1..79}; echo # print 79 -
|
||||||
|
exec "${scriptpath}/$scriptfile" "${args[@]}"
|
||||||
|
else
|
||||||
|
syslog_set warn "$script update to $tag had errors"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${Error}ERROR${Off}"\
|
||||||
|
"/tmp/$script-$shorttag.tar.gz not found!"
|
||||||
|
#ls /tmp | grep "$script" # debug
|
||||||
|
syslog_set warn "/tmp/$script-$shorttag.tar.gz not found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
cd "$scriptpath" || echo -e "${Error}ERROR${Off} Failed to cd to script location!"
|
||||||
|
else
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to cd to /tmp!"
|
||||||
|
syslog_set warn "$script update failed to cd to /tmp"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Set file variables
|
||||||
|
|
||||||
|
synoinfo="/etc.defaults/synoinfo.conf"
|
||||||
|
synoinfo2="/etc/synoinfo.conf"
|
||||||
|
strgmgr="/var/packages/StorageManager/target/ui/storage_panel.js"
|
||||||
|
libhw="/usr/lib/libhwcontrol.so.1"
|
||||||
|
|
||||||
|
if [[ ! -f ${libhw} ]]; then
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} $(basename -- $libhw) not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
rebootmsg(){
|
||||||
|
# Reboot prompt
|
||||||
|
echo -e "\n${Cyan}The Synology needs to restart.${Off}"
|
||||||
|
echo -e "Type ${Cyan}yes${Off} to reboot now."
|
||||||
|
echo -e "Type anything else to quit (if you will restart it yourself)."
|
||||||
|
read -r -t 10 answer
|
||||||
|
if [[ ${answer,,} != "yes" ]]; then exit; fi
|
||||||
|
|
||||||
|
# # Reboot in the background so user can see DSM's "going down" message
|
||||||
|
# reboot &
|
||||||
|
if [[ -x /usr/syno/sbin/synopoweroff ]]; then
|
||||||
|
/usr/syno/sbin/synopoweroff -r || reboot
|
||||||
|
else
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadmsg(){
|
||||||
|
# Reload browser prompt
|
||||||
|
echo -e "\nFinished"
|
||||||
|
echo -e "\nIf you have DSM open in a browser you need to"
|
||||||
|
echo "refresh the browser window or tab."
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Restore changes from backup file
|
||||||
|
|
||||||
|
compare_md5(){
|
||||||
|
# $1 is file 1
|
||||||
|
# $2 is file 2
|
||||||
|
if [[ -f "$1" ]] && [[ -f "$2" ]]; then
|
||||||
|
if [[ $(md5sum -b "$1" | awk '{print $1}') == $(md5sum -b "$2" | awk '{print $1}') ]];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
restoreerr=$((restoreerr+1))
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $restore == "yes" ]]; then
|
||||||
|
echo ""
|
||||||
|
if [[ -f ${synoinfo}.bak ]] || [[ -f ${libhw}.bak ]] ||\
|
||||||
|
[[ -f ${strgmgr}.${storagemgrver} ]]; then
|
||||||
|
|
||||||
|
# Restore synoinfo.conf from backup
|
||||||
|
if [[ -f ${synoinfo}.bak ]]; then
|
||||||
|
keyvalues=("support_btrfs_dedupe" "support_tiny_btrfs_dedupe")
|
||||||
|
for v in "${!keyvalues[@]}"; do
|
||||||
|
defaultval="$(/usr/syno/bin/synogetkeyvalue ${synoinfo}.bak "${keyvalues[v]}")"
|
||||||
|
if [[ -z $defaultval ]]; then defaultval="no"; fi
|
||||||
|
currentval="$(/usr/syno/bin/synogetkeyvalue ${synoinfo} "${keyvalues[v]}")"
|
||||||
|
if [[ $currentval != "$defaultval" ]]; then
|
||||||
|
if /usr/syno/bin/synosetkeyvalue "$synoinfo" "${keyvalues[v]}" "$defaultval";
|
||||||
|
then
|
||||||
|
restored="yes"
|
||||||
|
echo "Restored ${keyvalues[v]} = $defaultval"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo2" "${keyvalues[v]}" "$defaultval"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restore storage_panel.js from backup
|
||||||
|
if [[ -f "${strgmgr}.$storagemgrver" ]]; then
|
||||||
|
string1="(SYNO.SDS.StorageUtils.supportBtrfsDedupe)"
|
||||||
|
string2="(SYNO.SDS.StorageUtils.supportBtrfsDedupe&&e.dedup_info.show_config_btn)"
|
||||||
|
|
||||||
|
if grep -o "$string1" "${strgmgr}" >/dev/null; then
|
||||||
|
# Restore string in file
|
||||||
|
sed -i "s/${string1}/${string2/&&/\\&\\&}/g" "$strgmgr"
|
||||||
|
|
||||||
|
# Check we restored string in file
|
||||||
|
if grep -o "string2" "${strgmgr}" >/dev/null; then
|
||||||
|
restored="yes"
|
||||||
|
echo "Restored $(basename -- "$strgmgr")"
|
||||||
|
else
|
||||||
|
restoreerr=1
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to restore $(basename -- "$strgmgr")!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No backup of $(basename -- "$strgmgr") found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${libhw}.bak" ]]; then
|
||||||
|
# Check if backup libhwcontrol size matches
|
||||||
|
# in case backup is from previous DSM version
|
||||||
|
filesize=$(wc -c "${libhw}" | awk '{print $1}')
|
||||||
|
filebaksize=$(wc -c "${libhw}.bak" | awk '{print $1}')
|
||||||
|
if [[ ! $filesize -eq "$filebaksize" ]]; then
|
||||||
|
echo -e "${Yellow}WARNING Backup file size is different to file!${Off}"
|
||||||
|
echo "Do you want to restore this backup? [yes/no]:"
|
||||||
|
read -r -t 20 answer
|
||||||
|
if [[ $answer != "yes" ]]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Restore from backup
|
||||||
|
if ! compare_md5 "$libhw".bak "$libhw"; then
|
||||||
|
if cp -p "$libhw".bak "$libhw" ; then
|
||||||
|
restored="yes"
|
||||||
|
reboot="yes"
|
||||||
|
echo "Restored $(basename -- "$libhw")"
|
||||||
|
else
|
||||||
|
restoreerr=1
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to restore $(basename -- "$libhw")!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No backup of $(basename -- "$libhw") found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $restoreerr ]]; then
|
||||||
|
if [[ $restored == "yes" ]]; then
|
||||||
|
echo -e "\nRestore successful."
|
||||||
|
reloadmsg
|
||||||
|
else
|
||||||
|
echo -e "Nothing to restore."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $reboot == "yes" ]]; then
|
||||||
|
rebootmsg
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "No backups to restore from."
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Check NAS has enough memory
|
||||||
|
|
||||||
|
if [[ $restore != "yes" ]] && [[ $skip != "yes" ]]; then
|
||||||
|
IFS=$'\n' read -r -d '' -a array < <(dmidecode -t memory | grep -E "[Ss]ize: [0-9]+ [MG]{1}[B]{1}$")
|
||||||
|
if [[ ${#array[@]} -gt "0" ]]; then
|
||||||
|
num="0"
|
||||||
|
while [[ $num -lt "${#array[@]}" ]]; do
|
||||||
|
memcheck=$(printf %s "${array[num]}" | awk '{print $1}')
|
||||||
|
if [[ ${memcheck,,} == "size:" ]]; then
|
||||||
|
ramsize=$(printf %s "${array[num]}" | awk '{print $2}')
|
||||||
|
bytes=$(printf %s "${array[num]}" | awk '{print $3}')
|
||||||
|
if [[ $ramsize =~ ^[0-9]+$ ]]; then # Check $ramsize is numeric
|
||||||
|
if [[ $bytes == "GB" ]]; then # DSM 7.2 dmidecode returned GB
|
||||||
|
ramsize=$((ramsize * 1024)) # Convert to MB
|
||||||
|
fi
|
||||||
|
if [[ $ramtotal ]]; then
|
||||||
|
ramtotal=$((ramtotal +ramsize))
|
||||||
|
else
|
||||||
|
ramtotal="$ramsize"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
num=$((num +1))
|
||||||
|
done
|
||||||
|
|
||||||
|
ramgb=$((ramtotal / 1024))
|
||||||
|
|
||||||
|
if [[ $storagemgrver ]]; then
|
||||||
|
# Only DSM 7.2.1 and later supports tiny dedupe
|
||||||
|
if [[ $tiny == "yes" ]] || [[ $ramtotal -lt 16384 ]]; then
|
||||||
|
ramneeded="4096" # Tiny dedupe only needs 4GB ram
|
||||||
|
tiny="yes"
|
||||||
|
else
|
||||||
|
ramneeded="16384" # Needs 16GB ram
|
||||||
|
tiny=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ramneeded="16384" # Needs 16GB ram
|
||||||
|
tiny=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $ramtotal -lt "$ramneeded" ]]; then
|
||||||
|
ding
|
||||||
|
echo -e "\n${Error}ERROR${Off} Not enough memory installed for deduplication: $ramgb GB"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "\nNAS has $ramgb GB of memory."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "\n${Error}ERROR${Off} Unable to determine the amount of installed memory!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Edit libhwcontrol.so.1
|
||||||
|
|
||||||
|
findbytes(){
|
||||||
|
# Get decimal position of matching hex string
|
||||||
|
match=$(od -v -t x1 "$1" |
|
||||||
|
sed 's/[^ ]* *//' |
|
||||||
|
tr '\012' ' ' |
|
||||||
|
grep -b -i -o "$hexstring" |
|
||||||
|
#grep -b -i -o "$hexstring ".. |
|
||||||
|
cut -d ':' -f 1 |
|
||||||
|
xargs -I % expr % / 3)
|
||||||
|
|
||||||
|
# Convert decimal position of matching hex string to hex
|
||||||
|
array=("$match")
|
||||||
|
if [[ ${#array[@]} -gt "1" ]]; then
|
||||||
|
num="0"
|
||||||
|
while [[ $num -lt "${#array[@]}" ]]; do
|
||||||
|
poshex=$(printf "%x" "${array[$num]}")
|
||||||
|
if [[ $debug == "yes" ]]; then
|
||||||
|
echo "${array[$num]} = $poshex" # debug
|
||||||
|
fi
|
||||||
|
|
||||||
|
seek="${array[$num]}"
|
||||||
|
xxd=$(xxd -u -l 12 -s "$seek" "$1")
|
||||||
|
#echo "$xxd" # debug
|
||||||
|
if [[ $debug == "yes" ]]; then
|
||||||
|
printf %s "$xxd" | cut -d" " -f1-7
|
||||||
|
else
|
||||||
|
printf %s "$xxd" | cut -d" " -f1-7 >/dev/null
|
||||||
|
fi
|
||||||
|
bytes=$(printf %s "$xxd" | cut -d" " -f6)
|
||||||
|
#echo "$bytes" # debug
|
||||||
|
|
||||||
|
num=$((num +1))
|
||||||
|
done
|
||||||
|
elif [[ -n $match ]]; then
|
||||||
|
poshex=$(printf "%x" "$match")
|
||||||
|
if [[ $debug == "yes" ]]; then
|
||||||
|
echo "$match = $poshex" # debug
|
||||||
|
fi
|
||||||
|
|
||||||
|
seek="$match"
|
||||||
|
xxd=$(xxd -u -l 12 -s "$seek" "$1")
|
||||||
|
#echo "$xxd" # debug
|
||||||
|
if [[ $debug == "yes" ]]; then
|
||||||
|
printf %s "$xxd" | cut -d" " -f1-7
|
||||||
|
else
|
||||||
|
printf %s "$xxd" | cut -d" " -f1-7 >/dev/null
|
||||||
|
fi
|
||||||
|
bytes=$(printf %s "$xxd" | cut -d" " -f6)
|
||||||
|
#echo "$bytes" # debug
|
||||||
|
else
|
||||||
|
bytes=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Check value in file and backup file
|
||||||
|
if [[ $check == "yes" ]]; then
|
||||||
|
err=0
|
||||||
|
|
||||||
|
# Check if deduplication enabled in synoinfo.conf
|
||||||
|
sbd=support_btrfs_dedupe
|
||||||
|
stbd=support_tiny_btrfs_dedupe
|
||||||
|
setting="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${sbd})"
|
||||||
|
setting2="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${stbd})"
|
||||||
|
# if [[ $tiny != "yes" ]] || [[ $ramtotal -lt 16384 ]]; then
|
||||||
|
if [[ $setting == "yes" ]]; then
|
||||||
|
echo -e "\nBtrfs Data Deduplication is ${Cyan}enabled${Off}."
|
||||||
|
else
|
||||||
|
echo -e "\nBtrfs Data Deduplication is ${Cyan}not${Off} enabled."
|
||||||
|
fi
|
||||||
|
# else
|
||||||
|
if [[ $setting2 == "yes" ]]; then
|
||||||
|
echo -e "\nTiny Btrfs Data Deduplication is ${Cyan}enabled${Off}."
|
||||||
|
else
|
||||||
|
echo -e "\nTiny Btrfs Data Deduplication is ${Cyan}not${Off} enabled."
|
||||||
|
fi
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# DSM 7.2.1 only and only if --hdd option used
|
||||||
|
# Dedupe config button for HDDs and 2.5 inch SSDs in DSM 7.2.1
|
||||||
|
if [[ -f "$strgmgr" ]] && [[ $hdd == "yes" ]]; then
|
||||||
|
# StorageManager package is installed and --hdd option used
|
||||||
|
if ! grep '&&e.dedup_info.show_config_btn' "$strgmgr" >/dev/null; then
|
||||||
|
echo -e "\nDedupe config menu for HDDs and 2.5\" SSDs already enabled."
|
||||||
|
else
|
||||||
|
echo -e "\nDedupe config menu for HDDs and 2.5\" SSDs is ${Cyan}not${Off} enabled."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check value in file
|
||||||
|
echo -e "\nChecking non-Synology drive supported."
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 90 90 48 8B"
|
||||||
|
findbytes "$libhw"
|
||||||
|
if [[ $bytes == "9090" ]]; then
|
||||||
|
echo -e "File is already edited."
|
||||||
|
else
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 75 2. 48 8B"
|
||||||
|
findbytes "$libhw"
|
||||||
|
if [[ $bytes =~ "752"[0-9] ]]; then
|
||||||
|
echo -e "File is ${Cyan}not${Off} edited."
|
||||||
|
else
|
||||||
|
echo -e "${Red}hex string not found!${Off}"
|
||||||
|
err=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check value in backup file
|
||||||
|
if [[ -f ${libhw}.bak ]]; then
|
||||||
|
echo -e "\nChecking value in backup file."
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 75 2. 48 8B"
|
||||||
|
findbytes "${libhw}.bak"
|
||||||
|
if [[ $bytes =~ "752"[0-9] ]]; then
|
||||||
|
echo -e "Backup file is okay."
|
||||||
|
else
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 90 90 48 8B"
|
||||||
|
findbytes "${libhw}.bak"
|
||||||
|
if [[ $bytes == "9090" ]]; then
|
||||||
|
echo -e "${Red}Backup file has been edited!${Off}"
|
||||||
|
else
|
||||||
|
echo -e "${Red}hex string not found!${Off}"
|
||||||
|
err=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No backup file found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit "$err"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Backup libhwcontrol
|
||||||
|
|
||||||
|
if [[ ! -f ${libhw}.bak ]]; then
|
||||||
|
if cp -p "$libhw" "$libhw".bak ; then
|
||||||
|
echo "Backup successful."
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} Backup failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Check if backup size matches file size
|
||||||
|
filesize=$(wc -c "$libhw" | awk '{print $1}')
|
||||||
|
filebaksize=$(wc -c "${libhw}.bak" | awk '{print $1}')
|
||||||
|
if [[ ! $filesize -eq "$filebaksize" ]]; then
|
||||||
|
echo -e "${Yellow}WARNING Backup file size is different to file!${Off}"
|
||||||
|
echo "Maybe you've updated DSM since last running this script?"
|
||||||
|
echo "Renaming file.bak to file.bak.old"
|
||||||
|
mv "${libhw}.bak" "$libhw".bak.old
|
||||||
|
if cp -p "$libhw" "$libhw".bak ; then
|
||||||
|
echo "Backup successful."
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} Backup failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
#else
|
||||||
|
# echo "$(basename -- "$libhw") already backed up."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Edit libhwcontrol
|
||||||
|
|
||||||
|
#echo -e "\nChecking $(basename -- "$libhw")."
|
||||||
|
|
||||||
|
# Check if the file is already edited
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 90 90 48 8B"
|
||||||
|
findbytes "$libhw"
|
||||||
|
if [[ $bytes == "9090" ]]; then
|
||||||
|
#echo -e "\n$(basename -- "$libhw") already edited."
|
||||||
|
echo -e "\nNon-Synology drive support already enabled."
|
||||||
|
else
|
||||||
|
# Check if the file is okay for editing
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 75 2. 48 8B"
|
||||||
|
findbytes "$libhw"
|
||||||
|
if ! [[ $bytes =~ "752"[0-9] ]]; then
|
||||||
|
ding
|
||||||
|
echo -e "\n${Red}hex string not found!${Off}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace bytes in file
|
||||||
|
posrep=$(printf "%x\n" $((0x${poshex}+8)))
|
||||||
|
if ! printf %s "${posrep}: 9090" | xxd -r - "$libhw"; then
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to edit $(basename -- "$libhw")!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
# Check if libhwcontrol.so.1 was successfully edited
|
||||||
|
#echo -e "\nChecking if file was successfully edited."
|
||||||
|
hexstring="80 3E 00 B8 01 00 00 00 90 90 48 8B"
|
||||||
|
findbytes "$libhw"
|
||||||
|
if [[ $bytes == "9090" ]]; then
|
||||||
|
#echo -e "File successfully edited."
|
||||||
|
echo -e "\nEnabled non-Synology drive support."
|
||||||
|
#echo -e "\n${Cyan}You can now enable data deduplication"\
|
||||||
|
# "pool in Storage Manager.${Off}"
|
||||||
|
reboot="yes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Edit /etc.defaults/synoinfo.conf
|
||||||
|
|
||||||
|
# Backup synoinfo.conf if needed
|
||||||
|
if [[ ! -f ${synoinfo}.bak ]]; then
|
||||||
|
if cp -p "$synoinfo" "$synoinfo.bak"; then
|
||||||
|
echo -e "\nBacked up $(basename -- "$synoinfo")" >&2
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "\n${Error}ERROR 5${Off} Failed to backup $(basename -- "$synoinfo")!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
enabled=""
|
||||||
|
sbd=support_btrfs_dedupe
|
||||||
|
stbd=support_tiny_btrfs_dedupe
|
||||||
|
|
||||||
|
# Enable dedupe support if needed
|
||||||
|
setting="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${sbd})"
|
||||||
|
if [[ $tiny != "yes" ]]; then
|
||||||
|
if [[ ! $setting ]] || [[ $setting == "no" ]]; then
|
||||||
|
if [[ -n $sbd ]]; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo" "$sbd" yes
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo2" "$sbd" yes
|
||||||
|
enabled="yes"
|
||||||
|
fi
|
||||||
|
elif [[ $setting == "yes" ]]; then
|
||||||
|
echo -e "\nBtrfs Data Deduplication already enabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Disable support_tiny_btrfs_dedupe
|
||||||
|
if [[ $enabled == "yes" ]]; then
|
||||||
|
if grep "$stbd" "$synoinfo" >/dev/null; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo" "$stbd" no
|
||||||
|
fi
|
||||||
|
if grep "$stbd" "$synoinfo2" >/dev/null; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo2" "$stbd" no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable tiny dedupe support if needed
|
||||||
|
setting="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${stbd})"
|
||||||
|
if [[ $tiny == "yes" ]]; then
|
||||||
|
if [[ ! $setting ]] || [[ $setting == "no" ]]; then
|
||||||
|
if [[ -n $stbd ]]; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo" "$stbd" yes
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo2" "$stbd" yes
|
||||||
|
enabled="yes"
|
||||||
|
fi
|
||||||
|
elif [[ $setting == "yes" ]]; then
|
||||||
|
echo -e "\nTiny Btrfs Data Deduplication already enabled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Disable support_btrfs_dedupe
|
||||||
|
if [[ $enabled == "yes" ]]; then
|
||||||
|
if grep "$sbd" "$synoinfo" >/dev/null; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo" "$sbd" no
|
||||||
|
fi
|
||||||
|
if grep "$sbd" "$synoinfo2" >/dev/null; then
|
||||||
|
/usr/syno/bin/synosetkeyvalue "$synoinfo2" "$sbd" no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check if we enabled deduplication
|
||||||
|
setting="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${sbd})"
|
||||||
|
setting2="$(/usr/syno/bin/synogetkeyvalue "$synoinfo" ${stbd})"
|
||||||
|
if [[ $enabled == "yes" ]]; then
|
||||||
|
if [[ $tiny != "yes" ]]; then
|
||||||
|
if [[ $setting == "yes" ]]; then
|
||||||
|
echo -e "\nEnabled Btrfs Data Deduplication."
|
||||||
|
reload="yes"
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "\n${Error}ERROR${Off} Failed to enable Btrfs Data Deduplication!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ $setting2 == "yes" ]]; then
|
||||||
|
echo -e "\nEnabled Tiny Btrfs Data Deduplication."
|
||||||
|
reload="yes"
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "\n${Error}ERROR${Off} Failed to enable Tiny Btrfs Data Deduplication!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Edit /var/packages/StorageManager/target/ui/storage_panel.js
|
||||||
|
|
||||||
|
# Enable dedupe config button for HDDs in DSM 7.2.1
|
||||||
|
if [[ -f "$strgmgr" ]] && [[ $hdd == "yes" ]]; then
|
||||||
|
# StorageManager package is installed
|
||||||
|
if grep '&&e.dedup_info.show_config_btn' "$strgmgr" >/dev/null; then
|
||||||
|
# Backup storage_panel.js"
|
||||||
|
storagemgrver="$(synopkg version StorageManager)"
|
||||||
|
echo ""
|
||||||
|
if [[ ! -f "${strgmgr}.$storagemgrver" ]]; then
|
||||||
|
if cp -p "$strgmgr" "${strgmgr}.$storagemgrver"; then
|
||||||
|
echo -e "Backed up $(basename -- "$strgmgr")"
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to backup $(basename -- "$strgmgr")!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i 's/&&e.dedup_info.show_config_btn//g' "$strgmgr"
|
||||||
|
# Check if we edited file
|
||||||
|
if ! grep '&&e.dedup_info.show_config_btn' "$strgmgr" >/dev/null; then
|
||||||
|
echo -e "Enabled dedupe config menu for HDDs and 2.5\" SSDs."
|
||||||
|
reload="yes"
|
||||||
|
else
|
||||||
|
ding
|
||||||
|
echo -e "${Error}ERROR${Off} Failed to enable dedupe config menu for HDDs and 2.5\" SSDs!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "\nDedupe config menu for HDDs and 2.5\" SSDs already enabled."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Finished
|
||||||
|
|
||||||
|
if [[ $reboot == "yes" ]]; then
|
||||||
|
rebootmsg
|
||||||
|
elif [[ $reload == "yes" ]]; then
|
||||||
|
reloadmsg
|
||||||
|
else
|
||||||
|
echo -e "\nFinished"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit
|
30
deduplication/install.sh
Executable file
30
deduplication/install.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Creating service to exec deduplication"
|
||||||
|
cp -vf /usr/bin/deduplication.sh /tmpRoot/usr/bin/deduplication.sh
|
||||||
|
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/deduplication.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Enable Deduplication" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/deduplication.sh --tiny --hdd" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/deduplication.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/deduplication.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon deduplication - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/deduplication.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/deduplication.service"
|
||||||
|
|
||||||
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "/usr/bin/deduplication.sh --restore" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "rm -f /usr/bin/deduplication.sh" >>/tmpRoot/usr/arc/revert.sh
|
||||||
|
fi
|
19
deduplication/manifest.yml
Normal file
19
deduplication/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: deduplication
|
||||||
|
description: "Force enable Deduplication (Tiny >4GB RAM)"
|
||||||
|
system: false
|
||||||
|
beta: true
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
471
disks/install.sh
Executable file
471
disks/install.sh
Executable file
@ -0,0 +1,471 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get values in synoinfo.conf K=V file
|
||||||
|
# 1 - key
|
||||||
|
function _get_conf_kv() {
|
||||||
|
grep "${1}=" /etc/synoinfo.conf 2>/dev/null | sed "s|^${1}=\"\(.*\)\"$|\1|g"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replace/add values in synoinfo.conf K=V file
|
||||||
|
# Args: $1 rd|hd, $2 key, $3 val
|
||||||
|
function _set_conf_kv() {
|
||||||
|
local ROOT
|
||||||
|
local FILE
|
||||||
|
[ "$1" = "rd" ] && ROOT="" || ROOT="/tmpRoot"
|
||||||
|
for SD in etc etc.defaults; do
|
||||||
|
FILE="${ROOT}/${SD}/synoinfo.conf"
|
||||||
|
# Replace
|
||||||
|
if grep -q "^$2=" ${FILE}; then
|
||||||
|
sed -i ${FILE} -e "s\"^$2=.*\"$2=\\\"$3\\\"\""
|
||||||
|
else
|
||||||
|
# Add if doesn't exist
|
||||||
|
echo "$2=\"$3\"" >>${FILE}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the user has customized the key
|
||||||
|
# Args: $1 rd|hd, $2 key
|
||||||
|
function _check_post_k() {
|
||||||
|
local ROOT
|
||||||
|
[ "$1" = "rd" ] && ROOT="" || ROOT="/tmpRoot"
|
||||||
|
if grep -q -r "^_set_conf_kv.*${2}.*" "${ROOT}/sbin/init.post"; then
|
||||||
|
return 0 # true
|
||||||
|
else
|
||||||
|
return 1 # false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the raid has been completed currently
|
||||||
|
function _check_rootraidstatus() {
|
||||||
|
if [ ! "$(_get_conf_kv supportraid)" = "yes" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
STATE=$(cat /sys/block/md0/md/array_state 2>/dev/null)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
case ${STATE} in
|
||||||
|
"clear" | "inactive" | "suspended " | "readonly" | "read-auto")
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function _atoi() {
|
||||||
|
DISKNAME=${1}
|
||||||
|
NUM=0
|
||||||
|
IDX=0
|
||||||
|
while [ ${IDX} -lt ${#DISKNAME} ]; do
|
||||||
|
N=$(($(printf '%d' "'${DISKNAME:${IDX}:1}") - $(printf '%d' "'a") + 1))
|
||||||
|
BIT=$((${#DISKNAME} - 1 - ${IDX}))
|
||||||
|
[ ${BIT} -eq 0 ] && NUM=$((${NUM} + ${N})) || NUM=$((${NUM} + 26 ** ${BIT} * ${N}))
|
||||||
|
IDX=$((${IDX} + 1))
|
||||||
|
done
|
||||||
|
echo $((${NUM} - 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate linux kernel version code
|
||||||
|
# ex.
|
||||||
|
# KernelVersionCode "2.4.22" => 132118
|
||||||
|
# KernelVersionCode "2.6" => 132608
|
||||||
|
# KernelVersionCode "2.6.32" => 132640
|
||||||
|
# KernelVersionCode "3" => 196608
|
||||||
|
# KernelVersionCode "3.0.0" => 196608
|
||||||
|
function _kernelVersionCode() {
|
||||||
|
[ $# -eq 1 ] || return
|
||||||
|
|
||||||
|
local _version_string _major_version _minor_version _revision
|
||||||
|
_version_string="$(echo "$1" | /usr/bin/cut -d'_' -f1)."
|
||||||
|
_major_version=$(echo "${_version_string}" | /usr/bin/cut -d'.' -f1)
|
||||||
|
_minor_version=$(echo "${_version_string}" | /usr/bin/cut -d'.' -f2)
|
||||||
|
_revision=$(echo "${_version_string}" | /usr/bin/cut -d'.' -f3)
|
||||||
|
|
||||||
|
/bin/echo $((${_major_version:-0} * 65536 + ${_minor_version:-0} * 256 + ${_revision:-0}))
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get current linux kernel version without extra version
|
||||||
|
# format: VERSION.PATCHLEVEL.SUBLEVEL
|
||||||
|
# ex. "2.6.32"
|
||||||
|
function _kernelVersion() {
|
||||||
|
local _release
|
||||||
|
_release=$(/bin/uname -r)
|
||||||
|
/bin/echo ${_release%%[-+]*} | /usr/bin/cut -d'.' -f1-3
|
||||||
|
}
|
||||||
|
|
||||||
|
# synoboot
|
||||||
|
function checkSynoboot() {
|
||||||
|
[ -b /dev/synoboot -a -b /dev/synoboot1 -a -b /dev/synoboot2 -a -b /dev/synoboot3 ] && return
|
||||||
|
[ -z "${BOOTDISK}" ] && return
|
||||||
|
|
||||||
|
if [ ! -b /dev/synoboot -a -d /sys/block/${BOOTDISK} ]; then
|
||||||
|
/bin/mknod /dev/synoboot b $(cat /sys/block/${BOOTDISK}/dev | sed 's/:/ /') >/dev/null 2>&1
|
||||||
|
rm -vf /dev/${BOOTDISK}
|
||||||
|
fi
|
||||||
|
# 1,2,3 for sdN,vdN; p1,p2,p3 for sataN,nvmeXnN,mmcblkN.
|
||||||
|
for i in 1 2 3 p1 p2 p3; do
|
||||||
|
if [ ! -b /dev/synoboot${i/p/} -a -d /sys/block/${BOOTDISK}/${BOOTDISK}${i} ]; then
|
||||||
|
/bin/mknod /dev/synoboot${i/p/} b $(cat /sys/block/${BOOTDISK}/${BOOTDISK}${i}/dev | sed 's/:/ /') >/dev/null 2>&1
|
||||||
|
rm -vf /dev/${BOOTDISK}${i}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# USB ports
|
||||||
|
function getUsbPorts() {
|
||||||
|
for I in $(ls -d /sys/bus/usb/devices/usb* 2>/dev/null); do
|
||||||
|
# ROOT
|
||||||
|
DCLASS=$(cat ${I}/bDeviceClass)
|
||||||
|
[ ! "${DCLASS}" = "09" ] && continue
|
||||||
|
SPEED=$(cat ${I}/speed)
|
||||||
|
[ ${SPEED} -lt 480 ] && continue
|
||||||
|
RBUS=$(cat ${I}/busnum)
|
||||||
|
RCHILDS=$(cat ${I}/maxchild)
|
||||||
|
HAVE_CHILD=0
|
||||||
|
for C in $(seq 1 ${RCHILDS}); do
|
||||||
|
SUB="${RBUS}-${C}"
|
||||||
|
if [ -d "${I}/${SUB}" ]; then
|
||||||
|
DCLASS=$(cat ${I}/${SUB}/bDeviceClass)
|
||||||
|
[ ! "${DCLASS}" = "09" ] && continue
|
||||||
|
SPEED=$(cat ${I}/${SUB}/speed)
|
||||||
|
[ ${SPEED} -lt 480 ] && continue
|
||||||
|
CHILDS=$(cat ${I}/${SUB}/maxchild)
|
||||||
|
HAVE_CHILD=1
|
||||||
|
for N in $(seq 1 ${CHILDS}); do
|
||||||
|
echo -n "${RBUS}-${C}.${N} "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ ${HAVE_CHILD} -eq 0 ]; then
|
||||||
|
for N in $(seq 1 ${RCHILDS}); do
|
||||||
|
echo -n "${RBUS}-${N} "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
function dtModel() {
|
||||||
|
DEST="/addons/model.dts"
|
||||||
|
UNIQUE=$(_get_conf_kv unique)
|
||||||
|
|
||||||
|
if [ ! -f "${DEST}" ]; then # Users can put their own dts.
|
||||||
|
# Build dts file
|
||||||
|
echo "/dts-v1/;" >${DEST}
|
||||||
|
echo "/ {" >>${DEST}
|
||||||
|
echo " compatible = \"Synology\";" >>${DEST}
|
||||||
|
echo " model = \"${UNIQUE}\";" >>${DEST}
|
||||||
|
echo " version = <0x01>;" >>${DEST}
|
||||||
|
|
||||||
|
# NVME power_limit
|
||||||
|
POWER_LIMIT=""
|
||||||
|
NVME_PORTS=$(ls /sys/class/nvme 2>/dev/null | wc -w)
|
||||||
|
for I in $(seq 0 $((${NVME_PORTS} - 1))); do
|
||||||
|
[ ${I} -eq 0 ] && POWER_LIMIT="100" || POWER_LIMIT="${POWER_LIMIT},100"
|
||||||
|
done
|
||||||
|
if [ -n "${POWER_LIMIT}" ]; then
|
||||||
|
echo " power_limit = \"${POWER_LIMIT}\";" >>${DEST}
|
||||||
|
fi
|
||||||
|
if [ ${NVME_PORTS} -gt 0 ]; then
|
||||||
|
_set_conf_kv rd "supportnvme" "yes"
|
||||||
|
_set_conf_kv rd "support_m2_pool" "yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SATA ports
|
||||||
|
if [ "${1}" = "true" ]; then
|
||||||
|
I=1
|
||||||
|
# 106 = SATA
|
||||||
|
for P in $(lspci -d ::106 2>/dev/null | cut -d' ' -f1); do
|
||||||
|
HOSTNUM=$(ls -l /sys/class/scsi_host 2>/dev/null | grep ${P} | wc -l)
|
||||||
|
PCIPATH=""
|
||||||
|
for Q in $(ls -l /sys/class/scsi_host 2>/dev/null | grep ${P} | head -1 | grep -oE ":..\.."); do PCIPATH="${PCIPATH},${Q//:/}"; done
|
||||||
|
[ -z "${PCIPATH}" ] && continue
|
||||||
|
if [ "$(_kernelVersionCode "$(_kernelVersion)")" -ge "$(_kernelVersionCode "5.10")" ]; then
|
||||||
|
PCIPATH="0000:00:${PCIPATH:1}" # 5.10+ kernel TODO: check 0000
|
||||||
|
else
|
||||||
|
PCIPATH="00:${PCIPATH:1}" # 5.10- kernel
|
||||||
|
fi
|
||||||
|
|
||||||
|
IDX=""
|
||||||
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" ] && echo "${BOOTDISK_PHYSDEVPATH}" | grep -q "${P}"; then
|
||||||
|
IDX=$(ls -l /sys/class/scsi_host 2>/dev/null | grep ${P} | sort -V | grep -n "${BOOTDISK_PHYSDEVPATH%%target*}" | head -1 | cut -d: -f1)
|
||||||
|
if [ -n "${IDX}" ] && echo "${IDX}" | grep -q -E '^[0-9]+$'; then if [ ${IDX} -gt 0 ]; then IDX=$((${IDX} - 1)); else IDX="0"; fi; else IDX=""; fi
|
||||||
|
echo "bootloader: PCIPATH:${PCIPATH}; IDX:${IDX}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for J in $(seq 0 $((${HOSTNUM} - 1))); do
|
||||||
|
[ "${J}" = "${IDX}" ] && continue
|
||||||
|
echo " internal_slot@${I} {" >>${DEST}
|
||||||
|
echo " protocol_type = \"sata\";" >>${DEST}
|
||||||
|
echo " ahci {" >>${DEST}
|
||||||
|
echo " pcie_root = \"${PCIPATH}\";" >>${DEST}
|
||||||
|
echo " ata_port = <0x$(printf '%02X' ${J})>;" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
I=$((${I} + 1))
|
||||||
|
done
|
||||||
|
done
|
||||||
|
# 100 = SCSI, 104 = RAID, 107 = HBA
|
||||||
|
for P in $(lspci -d ::107 2>/dev/null | cut -d' ' -f1) $(lspci -d ::104 2>/dev/null | cut -d' ' -f1) $(lspci -d ::100 2>/dev/null | cut -d' ' -f1); do
|
||||||
|
J=1
|
||||||
|
while true; do
|
||||||
|
[ ! -d /sys/block/sata${J} ] && break
|
||||||
|
if cat /sys/block/sata${J}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | grep -q "${P}"; then
|
||||||
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat /sys/block/sata${J}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
||||||
|
echo "bootloader: /sys/block/sata${J}"
|
||||||
|
else
|
||||||
|
PCIEPATH=$(grep 'pciepath' /sys/block/sata${J}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
|
ATAPORT=$(grep 'ata_port_no' /sys/block/sata${J}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
|
if [ -n "${PCIEPATH}" -a -n "${ATAPORT}" ]; then
|
||||||
|
echo " internal_slot@${I} {" >>${DEST}
|
||||||
|
echo " protocol_type = \"sata\";" >>${DEST}
|
||||||
|
echo " ahci {" >>${DEST}
|
||||||
|
echo " pcie_root = \"${PCIEPATH}\";" >>${DEST}
|
||||||
|
echo " ata_port = <0x$(printf '%02X' ${ATAPORT})>;" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
I=$((${I} + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
J=$((${J} + 1))
|
||||||
|
done
|
||||||
|
done
|
||||||
|
else
|
||||||
|
I=1
|
||||||
|
J=1
|
||||||
|
while true; do
|
||||||
|
[ ! -d /sys/block/sata${J} ] && break
|
||||||
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat /sys/block/sata${J}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
||||||
|
echo "bootloader: /sys/block/sata${J}"
|
||||||
|
else
|
||||||
|
PCIEPATH=$(grep 'pciepath' /sys/block/sata${J}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
|
ATAPORT=$(grep 'ata_port_no' /sys/block/sata${J}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
|
if [ -n "${PCIEPATH}" -a -n "${ATAPORT}" ]; then
|
||||||
|
echo " internal_slot@${I} {" >>${DEST}
|
||||||
|
echo " protocol_type = \"sata\";" >>${DEST}
|
||||||
|
echo " ahci {" >>${DEST}
|
||||||
|
echo " pcie_root = \"${PCIEPATH}\";" >>${DEST}
|
||||||
|
echo " ata_port = <0x$(printf '%02X' ${ATAPORT})>;" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
I=$((${I} + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
J=$((${J} + 1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# Maxdisks Count
|
||||||
|
MAXDISKS=$((${I} - 1))
|
||||||
|
|
||||||
|
# NVME ports
|
||||||
|
COUNT=1
|
||||||
|
for P in $(ls -d /sys/block/nvme* 2>/dev/null); do
|
||||||
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
||||||
|
echo "bootloader: ${P}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
PCIEPATH=$(grep 'pciepath' ${P}/device/syno_block_info 2>/dev/null | cut -d'=' -f2)
|
||||||
|
if [ -n "${PCIEPATH}" ]; then
|
||||||
|
echo " nvme_slot@${COUNT} {" >>${DEST}
|
||||||
|
echo " pcie_root = \"${PCIEPATH}\";" >>${DEST}
|
||||||
|
echo " port_type = \"ssdcache\";" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
COUNT=$((${COUNT} + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# NVME Count
|
||||||
|
NVMEDISKS=$((${COUNT} - 1))
|
||||||
|
|
||||||
|
# USB ports
|
||||||
|
COUNT=1
|
||||||
|
for I in $(getUsbPorts); do
|
||||||
|
echo " usb_slot@${COUNT} {" >>${DEST}
|
||||||
|
echo " usb2 {" >>${DEST}
|
||||||
|
echo " usb_port =\"${I}\";" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
echo " usb3 {" >>${DEST}
|
||||||
|
echo " usb_port =\"${I}\";" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
echo " };" >>${DEST}
|
||||||
|
COUNT=$((${COUNT} + 1))
|
||||||
|
done
|
||||||
|
echo "};" >>${DEST}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# USB Count
|
||||||
|
USBDISKS=$((${COUNT} - 1))
|
||||||
|
|
||||||
|
# Check for custom MAXDISKS
|
||||||
|
if _check_post_k "rd" "maxdisks"; then
|
||||||
|
MAXDISKS=$(($(_get_conf_kv maxdisks)))
|
||||||
|
echo "get maxdisks=${MAXDISKS}"
|
||||||
|
else
|
||||||
|
[ ${MAXDISKS} -lt 26 ] && MAXDISKS=26
|
||||||
|
fi
|
||||||
|
_set_conf_kv rd "maxdisks" "${MAXDISKS}"
|
||||||
|
echo "maxdisks=${MAXDISKS}"
|
||||||
|
|
||||||
|
dtc -I dts -O dtb ${DEST} >/etc/model.dtb
|
||||||
|
cp -vf /etc/model.dtb /run/model.dtb
|
||||||
|
/usr/syno/bin/syno_slot_mapping
|
||||||
|
}
|
||||||
|
|
||||||
|
function nondtModel() {
|
||||||
|
if [ "${2}" = "force" ]; then
|
||||||
|
MAXDISKS=26
|
||||||
|
USBPORTCFG=0x00
|
||||||
|
ESATAPORTCFG=0x00
|
||||||
|
INTERNALPORTCFG=0x3ffffff
|
||||||
|
# Set Maxdisks and Portconfig
|
||||||
|
_set_conf_kv rd "maxdisks" "${MAXDISKS}"
|
||||||
|
echo "set maxdisks=${MAXDISKS} (force)"
|
||||||
|
_set_conf_kv rd "usbportcfg" "${USBPORTCFG}"
|
||||||
|
echo "set usbportcfg=${USBPORTCFG} (force)"
|
||||||
|
_set_conf_kv rd "esataportcfg" "${ESATAPORTCFG}"
|
||||||
|
echo "set esataportcfg=${ESATAPORTCFG} (force)"
|
||||||
|
_set_conf_kv rd "internalportcfg" "${INTERNALPORTCFG}"
|
||||||
|
echo "set internalportcfg=${INTERNALPORTCFG} (force)"
|
||||||
|
else
|
||||||
|
MAXDISKS=0
|
||||||
|
USBPORTCFG=0
|
||||||
|
ESATAPORTCFG=0
|
||||||
|
INTERNALPORTCFG=0
|
||||||
|
HBA_NUMBER=$(($(lspci -d ::107 2>/dev/null | wc -l) + $(lspci -d ::104 2>/dev/null | wc -l) + $(lspci -d ::100 2>/dev/null | wc -l)))
|
||||||
|
|
||||||
|
for I in $(ls -d /sys/block/sd* 2>/dev/null); do
|
||||||
|
IDX=$(_atoi ${I/\/sys\/block\/sd/})
|
||||||
|
ISUSB="$(cat ${I}/uevent 2>/dev/null | grep PHYSDEVPATH | grep usb)"
|
||||||
|
[ -n "${ISUSB}" ] && USBPORTCFG=$((${USBPORTCFG} | $((1 << ${IDX}))))
|
||||||
|
if [ -z "${ISUSB}" ] || [ "${2}" = "true" ]; then
|
||||||
|
MAXDISKS=$((${IDX} + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check for custom MAXDISKS
|
||||||
|
if _check_post_k "rd" "maxdisks"; then
|
||||||
|
MAXDISKS=$(($(_get_conf_kv maxdisks)))
|
||||||
|
echo "get maxdisks=${MAXDISKS}"
|
||||||
|
fi
|
||||||
|
# Check for custom USBPORTCFG
|
||||||
|
if _check_post_k "rd" "usbportcfg"; then
|
||||||
|
USBPORTCFG=$(($(_get_conf_kv usbportcfg)))
|
||||||
|
echo "get usbportcfg=${USBPORTCFG}"
|
||||||
|
fi
|
||||||
|
# Check for custom ESATAPORTCFG
|
||||||
|
if _check_post_k "rd" "esataportcfg"; then
|
||||||
|
ESATAPORTCFG=$(($(_get_conf_kv esataportcfg)))
|
||||||
|
echo "get esataportcfg=${ESATAPORTCFG}"
|
||||||
|
fi
|
||||||
|
# Check for custom INTERNALPORTCFG
|
||||||
|
if _check_post_k "rd" "internalportcfg"; then
|
||||||
|
INTERNALPORTCFG=$(($(_get_conf_kv internalportcfg)))
|
||||||
|
echo "get internalportcfg=${INTERNALPORTCFG}"
|
||||||
|
else
|
||||||
|
if [ "${2}" = "true" ]; then
|
||||||
|
INTERNALPORTCFG=$(($((2 ** ${MAXDISKS} - 1)) ^ ${USBPORTCFG} ^ ${ESATAPORTCFG}))
|
||||||
|
else
|
||||||
|
INTERNALPORTCFG=$((2 ** ${MAXDISKS} - 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Set Maxdisks and Portconfig
|
||||||
|
_set_conf_kv rd "maxdisks" "${MAXDISKS}"
|
||||||
|
echo "set maxdisks=${MAXDISKS}"
|
||||||
|
_set_conf_kv rd "usbportcfg" "$(printf '0x%.2x' ${USBPORTCFG})"
|
||||||
|
echo "set usbportcfg=${USBPORTCFG}"
|
||||||
|
_set_conf_kv rd "esataportcfg" "$(printf "0x%.2x" ${ESATAPORTCFG})"
|
||||||
|
echo "set esataportcfg=${ESATAPORTCFG}"
|
||||||
|
_set_conf_kv rd "internalportcfg" "$(printf "0x%.2x" ${INTERNALPORTCFG})"
|
||||||
|
echo "set internalportcfg=${INTERNALPORTCFG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1}" = "true" ]; then
|
||||||
|
echo "TODO: no-DT's sort!!!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NVME
|
||||||
|
COUNT=1
|
||||||
|
echo "[pci]" >/etc/extensionPorts
|
||||||
|
for P in $(ls -d /sys/block/nvme* 2>/dev/null); do
|
||||||
|
if [ -n "${BOOTDISK_PHYSDEVPATH}" -a "${BOOTDISK_PHYSDEVPATH}" = "$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" ]; then
|
||||||
|
echo "bootloader: ${P}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
PCIEPATH=$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'/' -f4)
|
||||||
|
if [ -n "${PCIEPATH}" ]; then
|
||||||
|
# TODO: Need check?
|
||||||
|
# MULTIPATH=$(cat ${P}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'/' -f5)
|
||||||
|
# if [ -z "${MULTIPATH}" ]; then
|
||||||
|
# echo "${PCIEPATH} does not support!"
|
||||||
|
# continue
|
||||||
|
# fi
|
||||||
|
echo "pci${COUNT}=\"${PCIEPATH}\"" >>/etc/extensionPorts
|
||||||
|
COUNT=$((${COUNT} + 1))
|
||||||
|
|
||||||
|
_set_conf_kv rd "supportnvme" "yes"
|
||||||
|
_set_conf_kv rd "support_m2_pool" "yes"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
if [ "${1}" = "patches" ]; then
|
||||||
|
echo "Installing addon disks - ${1}"
|
||||||
|
|
||||||
|
BOOTDISK_PART3_PATH=$(blkid -L ARC3 2>/dev/null)
|
||||||
|
[ -n "${BOOTDISK_PART3_PATH}" ] && BOOTDISK_PART3_MAJORMINOR="$((0x$(stat -c '%t' "${BOOTDISK_PART3_PATH}"))):$((0x$(stat -c '%T' "${BOOTDISK_PART3_PATH}")))" || BOOTDISK_PART3_MAJORMINOR=""
|
||||||
|
[ -n "${BOOTDISK_PART3_MAJORMINOR}" ] && BOOTDISK_PART3="$(cat /sys/dev/block/${BOOTDISK_PART3_MAJORMINOR}/uevent 2>/dev/null | grep 'DEVNAME' | cut -d'=' -f2)" || BOOTDISK_PART3=""
|
||||||
|
|
||||||
|
[ -n "${BOOTDISK_PART3}" ] && BOOTDISK=$(ls -d /sys/block/*/${BOOTDISK_PART3} 2>/dev/null | cut -d'/' -f4) || BOOTDISK=""
|
||||||
|
[ -n "${BOOTDISK}" ] && BOOTDISK_PHYSDEVPATH="$(cat /sys/block/${BOOTDISK}/uevent 2>/dev/null | grep 'PHYSDEVPATH' | cut -d'=' -f2)" || BOOTDISK_PHYSDEVPATH=""
|
||||||
|
|
||||||
|
echo "BOOTDISK=${BOOTDISK}"
|
||||||
|
echo "BOOTDISK_PHYSDEVPATH=${BOOTDISK_PHYSDEVPATH}"
|
||||||
|
|
||||||
|
checkSynoboot
|
||||||
|
|
||||||
|
[ "$(_get_conf_kv supportportmappingv2)" = "yes" ] && dtModel "${2}" || nondtModel "${2}" "${3}"
|
||||||
|
|
||||||
|
elif [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon disks - ${1}"
|
||||||
|
if [ "$(_get_conf_kv supportportmappingv2)" = "yes" ]; then
|
||||||
|
echo "Copying /etc.defaults/model.dtb"
|
||||||
|
# copy file
|
||||||
|
cp -vf /etc/model.dtb /tmpRoot/etc/model.dtb
|
||||||
|
cp -vf /etc/model.dtb /tmpRoot/etc.defaults/model.dtb
|
||||||
|
else
|
||||||
|
# sysfs is unpopulated here, get the values from junior synoinfo.conf
|
||||||
|
USBPORTCFG=$(_get_conf_kv usbportcfg)
|
||||||
|
ESATAPORTCFG=$(_get_conf_kv esataportcfg)
|
||||||
|
INTERNALPORTCFG=$(_get_conf_kv internalportcfg)
|
||||||
|
# log
|
||||||
|
echo "usbportcfg=${USBPORTCFG}"
|
||||||
|
echo "esataportcfg=${ESATAPORTCFG}"
|
||||||
|
echo "internalportcfg=${INTERNALPORTCFG}"
|
||||||
|
# set
|
||||||
|
_set_conf_kv hd "usbportcfg" "${USBPORTCFG}"
|
||||||
|
_set_conf_kv hd "esataportcfg" "${ESATAPORTCFG}"
|
||||||
|
_set_conf_kv hd "internalportcfg" "${INTERNALPORTCFG}"
|
||||||
|
# nvme
|
||||||
|
cp -vf /etc/extensionPorts /tmpRoot/etc/extensionPorts
|
||||||
|
cp -vf /etc/extensionPorts /tmpRoot/etc.defaults/extensionPorts
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAXDISKS=$(_get_conf_kv maxdisks)
|
||||||
|
echo "maxdisks=${MAXDISKS}"
|
||||||
|
_set_conf_kv hd "maxdisks" "${MAXDISKS}"
|
||||||
|
|
||||||
|
SUPPORTNVME=$(_get_conf_kv supportnvme)
|
||||||
|
SUPPORT_M2_POOL=$(_get_conf_kv support_m2_pool)
|
||||||
|
_set_conf_kv hd "supportnvme" "${SUPPORTNVME}"
|
||||||
|
_set_conf_kv hd "support_m2_pool" "${SUPPORT_M2_POOL}"
|
||||||
|
fi
|
19
disks/manifest.yml
Executable file
19
disks/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: disks
|
||||||
|
description: "Config disks related setting"
|
||||||
|
system: true
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
45
dsmconfigbackup/all/usr/bin/dsmconfigbackup.sh
Executable file
45
dsmconfigbackup/all/usr/bin/dsmconfigbackup.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# email
|
||||||
|
# cat /usr/syno/etc/synosmtp.conf
|
||||||
|
# gvfs
|
||||||
|
# ls /var/tmp/user/1026/gvfs/ /usr/syno/etc/synovfs/1026
|
||||||
|
|
||||||
|
NUM="${1:-7}"
|
||||||
|
PRE="${2:-dsm}"
|
||||||
|
|
||||||
|
BACKUPPATH="/usr/arc/dsmbackup"
|
||||||
|
FILENAME="${PRE}_$(date +%Y%m%d%H%M%S).dss"
|
||||||
|
mkdir -p "${BACKUPPATH}"
|
||||||
|
/usr/syno/bin/synoconfbkp export --filepath="${BACKUPPATH}/${FILENAME}"
|
||||||
|
echo "Backup to ${BACKUPPATH}/${FILENAME}"
|
||||||
|
|
||||||
|
for I in $(ls ${BACKUPPATH}/${PRE}*.dss | sort -r | awk "NR>${NUM}"); do
|
||||||
|
rm -f "${I}"
|
||||||
|
done
|
||||||
|
|
||||||
|
PART1_PATH="$(cat /proc/mounts | grep '/dev/synoboot1' | cut -d' ' -f2)"
|
||||||
|
if [ -z "${PART1_PATH}" ]; then
|
||||||
|
echo 1 >/proc/sys/kernel/syno_install_flag
|
||||||
|
mkdir -p /mnt/p1
|
||||||
|
mount /dev/synoboot1 /mnt/p1
|
||||||
|
[ $? -ne 0 ] && exit 1
|
||||||
|
rm -rf /mnt/p1/dsmbackup
|
||||||
|
cp -rf "${BACKUPPATH}" /mnt/p1/
|
||||||
|
sync
|
||||||
|
umount /mnt/p1
|
||||||
|
echo 0 >/proc/sys/kernel/syno_install_flag
|
||||||
|
else
|
||||||
|
rm -rf "${PART1_PATH}/dsmbackup"
|
||||||
|
cp -rf "${BACKUPPATH}" "${PART1_PATH}/"
|
||||||
|
sync
|
||||||
|
fi
|
||||||
|
echo "Backup to /mnt/p1/dsmbackup"
|
||||||
|
|
||||||
|
exit 0
|
42
dsmconfigbackup/install.sh
Executable file
42
dsmconfigbackup/install.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon synoconfbkp - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/dsmconfigbackup.sh /tmpRoot/usr/bin/dsmconfigbackup.sh
|
||||||
|
|
||||||
|
if [ ! -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
|
||||||
|
echo "copy esynoscheduler.db"
|
||||||
|
mkdir -p /tmpRoot/usr/syno/etc/esynoscheduler
|
||||||
|
cp -vf /addons/esynoscheduler.db /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db
|
||||||
|
fi
|
||||||
|
echo "insert synoconfbkp task to esynoscheduler.db"
|
||||||
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
||||||
|
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
||||||
|
DELETE FROM task WHERE task_name LIKE 'SynoconfbkpBootup';
|
||||||
|
INSERT INTO task VALUES('SynoconfbkpBootup', '', 'bootup', '', 1, 0, 0, 0, '', 0, "/usr/bin/dsmconfigbackup.sh ${2:-7} ${3:-bkp}_bootup", 'script', '{}', '', '', '{}', '{}');
|
||||||
|
DELETE FROM task WHERE task_name LIKE 'SynoconfbkpShutdown';
|
||||||
|
INSERT INTO task VALUES('SynoconfbkpShutdown', '', 'shutdown', '', 1, 0, 0, 0, '', 0, "/usr/bin/dsmconfigbackup.sh ${2:-7} ${3:-bkp}_shutdown", 'script', '{}', '', '', '{}', '{}');
|
||||||
|
EOF
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon synoconfbkp - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/bin/dsmconfigbackup.sh"
|
||||||
|
|
||||||
|
if [ -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
|
||||||
|
echo "delete synoconfbkp task from esynoscheduler.db"
|
||||||
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
||||||
|
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
||||||
|
DELETE FROM task WHERE task_name LIKE 'SynoconfbkpBootup';
|
||||||
|
DELETE FROM task WHERE task_name LIKE 'SynoconfbkpShutdown';
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
19
dsmconfigbackup/manifest.yml
Normal file
19
dsmconfigbackup/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: dsmconfigbackup
|
||||||
|
description: "Automatically backup Systemconfig Settings to the Bootloader Disk(/mnt/p1/dsmbackup) at Shutdown."
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
BIN
eudev/all/addons/eudev-7.1.tgz
Normal file
BIN
eudev/all/addons/eudev-7.1.tgz
Normal file
Binary file not shown.
107
eudev/install.sh
Executable file
107
eudev/install.sh
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "early" ]; then
|
||||||
|
echo "Installing addon eudev - ${1}"
|
||||||
|
tar zxf /addons/eudev-7.1.tgz -C /
|
||||||
|
|
||||||
|
elif [ "${1}" = "modules" ]; then
|
||||||
|
echo "Installing addon eudev - ${1}"
|
||||||
|
|
||||||
|
# mv -f /usr/lib/udev/rules.d/60-persistent-storage.rules /usr/lib/udev/rules.d/60-persistent-storage.rules.bak
|
||||||
|
# mv -f /usr/lib/udev/rules.d/60-persistent-storage-tape.rules /usr/lib/udev/rules.d/60-persistent-storage-tape.rules.bak
|
||||||
|
# mv -f /usr/lib/udev/rules.d/80-net-name-slot.rules /usr/lib/udev/rules.d/80-net-name-slot.rules.bak
|
||||||
|
[ -e /proc/sys/kernel/hotplug ] && printf '\000\000\000\000' >/proc/sys/kernel/hotplug
|
||||||
|
/usr/sbin/depmod -a
|
||||||
|
/usr/sbin/udevd -d || {
|
||||||
|
echo "FAIL"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
echo "Triggering add events to udev"
|
||||||
|
udevadm trigger --type=subsystems --action=add
|
||||||
|
udevadm trigger --type=devices --action=add
|
||||||
|
udevadm trigger --type=devices --action=change
|
||||||
|
udevadm settle --timeout=30 || echo "udevadm settle failed"
|
||||||
|
# Give more time
|
||||||
|
sleep 10
|
||||||
|
# Remove from memory to not conflict with RAID mount scripts
|
||||||
|
/usr/bin/killall udevd
|
||||||
|
# Remove kvm module
|
||||||
|
/usr/sbin/lsmod 2>/dev/null | grep -q ^kvm_intel && /usr/sbin/rmmod kvm_intel || true # kvm-intel.ko
|
||||||
|
/usr/sbin/lsmod 2>/dev/null | grep -q ^kvm_amd && /usr/sbin/rmmod kvm_amd || true # kvm-amd.ko
|
||||||
|
/usr/sbin/lsmod 2>/dev/null | grep -q ^kvm && /usr/sbin/rmmod kvm || true
|
||||||
|
/usr/sbin/lsmod 2>/dev/null | grep -q ^irqbypass && /usr/sbin/rmmod irqbypass || true
|
||||||
|
|
||||||
|
elif [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon eudev - ${1}"
|
||||||
|
|
||||||
|
echo "copy modules"
|
||||||
|
isChange="false"
|
||||||
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
||||||
|
/tmpRoot/bin/cp -rnf /usr/lib/firmware/* /tmpRoot/usr/lib/firmware/
|
||||||
|
if cat /proc/version 2>/dev/null | grep -q 'RR@RR'; then
|
||||||
|
if [ -d /tmpRoot/usr/lib/modules.bak ]; then
|
||||||
|
/tmpRoot/bin/rm -rf /tmpRoot/usr/lib/modules
|
||||||
|
/tmpRoot/bin/cp -rf /tmpRoot/usr/lib/modules.bak /tmpRoot/usr/lib/modules
|
||||||
|
else
|
||||||
|
echo "Custom - backup modules."
|
||||||
|
/tmpRoot/bin/cp -rf /tmpRoot/usr/lib/modules /tmpRoot/usr/lib/modules.bak
|
||||||
|
fi
|
||||||
|
/tmpRoot/bin/cp -rf /usr/lib/modules/* /tmpRoot/usr/lib/modules
|
||||||
|
echo "true" >/tmp/modulesChange
|
||||||
|
else
|
||||||
|
if [ -d /tmpRoot/usr/lib/modules.bak ]; then
|
||||||
|
echo "Custom - restore modules from backup."
|
||||||
|
/tmpRoot/bin/rm -rf /tmpRoot/usr/lib/modules
|
||||||
|
/tmpRoot/bin/mv -rf /tmpRoot/usr/lib/modules.bak /tmpRoot/usr/lib/modules
|
||||||
|
fi
|
||||||
|
cat /addons/modulelist 2>/dev/null | /tmpRoot/bin/sed '/^\s*$/d' | while IFS=' ' read -r O M; do
|
||||||
|
[ "${O:0:1}" = "#" ] && continue
|
||||||
|
[ -z "${M}" -o -z "$(ls /usr/lib/modules/${M} 2>/dev/null)" ] && continue
|
||||||
|
if [ "${O}" = "F" ] || [ "${O}" = "f" ]; then
|
||||||
|
/tmpRoot/bin/cp -vrf /usr/lib/modules/${M} /tmpRoot/usr/lib/modules/
|
||||||
|
else
|
||||||
|
/tmpRoot/bin/cp -vrn /usr/lib/modules/${M} /tmpRoot/usr/lib/modules/
|
||||||
|
fi
|
||||||
|
# isChange="true"
|
||||||
|
# In Bash, the pipe operator | creates a subshell to execute the commands in the pipe.
|
||||||
|
# This means that if you modify a variable inside a while loop,
|
||||||
|
# the modification is not visible outside the loop because the while loop is executed in a subshell.
|
||||||
|
echo "true" >/tmp/modulesChange
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
isChange="$(cat /tmp/modulesChange 2>/dev/null || echo "false")"
|
||||||
|
echo "isChange: ${isChange}"
|
||||||
|
[ "${isChange}" = "true" ] && /usr/sbin/depmod -a -b /tmpRoot
|
||||||
|
|
||||||
|
# Restore kvm module
|
||||||
|
/usr/sbin/insmod /usr/lib/modules/irqbypass.ko || true
|
||||||
|
/usr/sbin/insmod /usr/lib/modules/kvm.ko || true
|
||||||
|
/usr/sbin/insmod /usr/lib/modules/kvm-intel.ko || true # kvm-intel.ko
|
||||||
|
/usr/sbin/insmod /usr/lib/modules/kvm-amd.ko || true # kvm-amd.ko
|
||||||
|
|
||||||
|
echo "Copy rules"
|
||||||
|
cp -vf /usr/lib/udev/rules.d/* /tmpRoot/usr/lib/udev/rules.d/
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/udevrules.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Reload udev rules" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/udevadm hwdb --update" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/udevadm control --reload-rules" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/udevrules.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/udevrules.service
|
||||||
|
fi
|
19
eudev/manifest.yml
Executable file
19
eudev/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: eudev
|
||||||
|
description: "eudev + kmod will assist with auto module loading"
|
||||||
|
system: true
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
37
expands/all/usr/bin/expands.sh
Executable file
37
expands/all/usr/bin/expands.sh
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# usb.map
|
||||||
|
FILE="/usr/syno/etc.defaults/usb.map"
|
||||||
|
if [ -f "${FILE}" ]; then
|
||||||
|
STATUS=$(curl -kL -w "%{http_code}" "http://www.linux-usb.org/usb.ids" -o "/tmp/usb.map")
|
||||||
|
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||||
|
echo "usb.ids download error!"
|
||||||
|
else
|
||||||
|
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
|
||||||
|
cp -f "/tmp/usb.map" "${FILE}"
|
||||||
|
if [ -f "${FILE/\.defaults/}" ]; then
|
||||||
|
[ ! -f "${FILE/\.defaults/}.bak" ] && cp -f "${FILE/\.defaults/}" "${FILE/\.defaults/}.bak"
|
||||||
|
cp -f "/tmp/usb.map" "${FILE/\.defaults/}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ca-certificates.crt
|
||||||
|
FILE="/etc/ssl/certs/ca-certificates.crt"
|
||||||
|
if [ -f "${FILE}" ]; then
|
||||||
|
STATUS=$(curl -kL -w "%{http_code}" "https://curl.se/ca/cacert.pem" -o "/tmp/cacert.pem")
|
||||||
|
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
|
||||||
|
echo "ca-certificates.crt download error!"
|
||||||
|
else
|
||||||
|
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
|
||||||
|
cp -f "/tmp/cacert.pem" "${FILE}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit
|
42
expands/install.sh
Executable file
42
expands/install.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon expands - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/expands.sh /tmpRoot/usr/bin/expands.sh
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/expands.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Expanded miscellaneous" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/expands.sh" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/expands.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/expands.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon expands - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/expands.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/expands.service"
|
||||||
|
|
||||||
|
FILE="/tmpRoot/usr/syno/etc.defaults/usb.map"
|
||||||
|
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
|
||||||
|
FILE="/tmpRoot/etc/ssl/certs/ca-certificates.crt"
|
||||||
|
[ -f "${FILE}.bak" ] && mv -f "${FILE}.bak" "${FILE}"
|
||||||
|
fi
|
19
expands/manifest.yml
Normal file
19
expands/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: expands
|
||||||
|
description: "Expanded miscellaneous, updated usb.map, ca-certificates.crt, etc."
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
1974
hdddb/all/usr/bin/hdddb.sh
Executable file
1974
hdddb/all/usr/bin/hdddb.sh
Executable file
File diff suppressed because it is too large
Load Diff
41
hdddb/install.sh
Executable file
41
hdddb/install.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon hdddb - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/bin/hdddb.sh /tmpRoot/usr/bin/hdddb.sh
|
||||||
|
|
||||||
|
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||||
|
DEST="/tmpRoot/usr/lib/systemd/system/hdddb.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=HDDs/SSDs drives databases" >>${DEST}
|
||||||
|
echo "After=multi-user.target" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/bin/hdddb.sh -nfre" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /usr/lib/systemd/system/hdddb.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/hdddb.service
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon hdddb - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/hdddb.service"
|
||||||
|
rm -f "/tmpRoot/usr/lib/systemd/system/hdddb.service"
|
||||||
|
|
||||||
|
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "/usr/bin/hdddb.sh --restore" >> /tmpRoot/usr/arc/revert.sh
|
||||||
|
echo "rm -f /usr/bin/hdddb.sh" >> /tmpRoot/usr/arc/revert.sh
|
||||||
|
fi
|
19
hdddb/manifest.yml
Normal file
19
hdddb/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: hdddb
|
||||||
|
description: "Add Disks to DSM compatibility DiskDB (Create Volume with non supported Disks)"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
28
hostspatch/all/usr/sbin/hostspatch.sh
Executable file
28
hostspatch/all/usr/sbin/hostspatch.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Define the entries to be added
|
||||||
|
ENTRIES=("127.0.0.1 checkip.synology.com" "::1 checkipv6.synology.com")
|
||||||
|
|
||||||
|
# Loop over each entry
|
||||||
|
for ENTRY in "${ENTRIES[@]}"
|
||||||
|
do
|
||||||
|
if [ -f /etc/hosts ]; then
|
||||||
|
# Check if the entry is already in the file
|
||||||
|
if grep -Fxq "$ENTRY" /etc/hosts; then
|
||||||
|
echo "Entry $ENTRY already exists"
|
||||||
|
else
|
||||||
|
echo "Entry $ENTRY does not exist, adding now"
|
||||||
|
echo "$ENTRY" >> /etc/hosts
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f /etc.defaults/hosts ]; then
|
||||||
|
if grep -Fxq "$ENTRY" /etc.defaults/hosts; then
|
||||||
|
echo "Entry $ENTRY already exists"
|
||||||
|
else
|
||||||
|
echo "Entry $ENTRY does not exist, adding now"
|
||||||
|
echo "$ENTRY" >> /etc.defaults/hosts
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
21
hostspatch/install.sh
Executable file
21
hostspatch/install.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Creating service to exec Hostspatch"
|
||||||
|
cp -vf /usr/sbin/hostspatch.sh /tmpRoot/usr/sbin/hostspatch.sh
|
||||||
|
|
||||||
|
DEST="/tmpRoot/lib/systemd/system/hostspatch.service"
|
||||||
|
echo "[Unit]" >${DEST}
|
||||||
|
echo "Description=Enable Hostspatch" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Service]" >>${DEST}
|
||||||
|
echo "Type=oneshot" >>${DEST}
|
||||||
|
echo "RemainAfterExit=yes" >>${DEST}
|
||||||
|
echo "ExecStart=/usr/sbin/hostspatch.sh" >>${DEST}
|
||||||
|
echo >>${DEST}
|
||||||
|
echo "[Install]" >>${DEST}
|
||||||
|
echo "WantedBy=multi-user.target" >>${DEST}
|
||||||
|
|
||||||
|
mkdir -vp /tmpRoot/lib/systemd/system/multi-user.target.wants
|
||||||
|
ln -vsf /lib/systemd/system/hostspatch.service /tmpRoot/lib/systemd/system/multi-user.target.wants/hostspatch.service
|
||||||
|
fi
|
19
hostspatch/manifest.yml
Normal file
19
hostspatch/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: hostspatch
|
||||||
|
description: "Prevent DSM from calling Home (Can break Syno Services)"
|
||||||
|
system: false
|
||||||
|
beta: true
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
479
i915/all/addons/i915ids
Normal file
479
i915/all/addons/i915ids
Normal file
@ -0,0 +1,479 @@
|
|||||||
|
# INTEL_I810_IDS
|
||||||
|
80867121
|
||||||
|
80867123
|
||||||
|
80867125
|
||||||
|
# INTEL_I815_IDS
|
||||||
|
80861132
|
||||||
|
# INTEL_I830_IDS
|
||||||
|
80863577
|
||||||
|
# INTEL_I845G_IDS
|
||||||
|
80862562
|
||||||
|
# INTEL_I85X_IDS
|
||||||
|
80863582
|
||||||
|
8086358e
|
||||||
|
# INTEL_I865G_IDS
|
||||||
|
80862572
|
||||||
|
# INTEL_I915G_IDS
|
||||||
|
80862582
|
||||||
|
8086258a
|
||||||
|
# INTEL_I915GM_IDS
|
||||||
|
80862592
|
||||||
|
# INTEL_I945G_IDS
|
||||||
|
80862772
|
||||||
|
# INTEL_I945GM_IDS
|
||||||
|
808627a2
|
||||||
|
808627ae
|
||||||
|
# INTEL_I965G_IDS
|
||||||
|
80862972
|
||||||
|
80862982
|
||||||
|
80862992
|
||||||
|
808629a2
|
||||||
|
# INTEL_G33_IDS
|
||||||
|
808629b2
|
||||||
|
808629c2
|
||||||
|
808629d2
|
||||||
|
# INTEL_I965GM_IDS
|
||||||
|
80862a02
|
||||||
|
80862a12
|
||||||
|
# INTEL_GM45_IDS
|
||||||
|
80862a42
|
||||||
|
# INTEL_G45_IDS
|
||||||
|
80862e02
|
||||||
|
80862e12
|
||||||
|
80862e22
|
||||||
|
80862e32
|
||||||
|
80862e42
|
||||||
|
80862e92
|
||||||
|
# INTEL_PINEVIEW_G_IDS
|
||||||
|
8086a001
|
||||||
|
# INTEL_PINEVIEW_M_IDS
|
||||||
|
8086a011
|
||||||
|
# INTEL_IRONLAKE_D_IDS
|
||||||
|
80860042
|
||||||
|
# INTEL_IRONLAKE_M_IDS
|
||||||
|
80860046
|
||||||
|
# INTEL_SNB_D_GT1_IDS
|
||||||
|
80860102
|
||||||
|
8086010A
|
||||||
|
# INTEL_SNB_D_GT2_IDS
|
||||||
|
80860112
|
||||||
|
80860122
|
||||||
|
# INTEL_SNB_M_GT1_IDS
|
||||||
|
80860106
|
||||||
|
# INTEL_SNB_M_GT2_IDS
|
||||||
|
80860116
|
||||||
|
80860126
|
||||||
|
# INTEL_IVB_M_GT1_IDS
|
||||||
|
80860156
|
||||||
|
# INTEL_IVB_M_GT2_IDS
|
||||||
|
80860166
|
||||||
|
# INTEL_IVB_D_GT1_IDS
|
||||||
|
80860152
|
||||||
|
8086015a
|
||||||
|
# INTEL_IVB_D_GT2_IDS
|
||||||
|
80860162
|
||||||
|
8086016a
|
||||||
|
# INTEL_HSW_ULT_GT1_IDS
|
||||||
|
80860A02
|
||||||
|
80860A06
|
||||||
|
80860A0A
|
||||||
|
80860A0B
|
||||||
|
# INTEL_HSW_ULX_GT1_IDS
|
||||||
|
80860A0E
|
||||||
|
# INTEL_HSW_GT1_IDS
|
||||||
|
80860402
|
||||||
|
80860406
|
||||||
|
8086040A
|
||||||
|
8086040B
|
||||||
|
8086040E
|
||||||
|
80860C02
|
||||||
|
80860C06
|
||||||
|
80860C0A
|
||||||
|
80860C0B
|
||||||
|
80860C0E
|
||||||
|
80860D02
|
||||||
|
80860D06
|
||||||
|
80860D0A
|
||||||
|
80860D0B
|
||||||
|
80860D0E
|
||||||
|
# INTEL_HSW_ULT_GT2_IDS
|
||||||
|
80860A12
|
||||||
|
80860A16
|
||||||
|
80860A1A
|
||||||
|
80860A1B
|
||||||
|
# INTEL_HSW_ULX_GT2_IDS
|
||||||
|
80860A1E
|
||||||
|
# INTEL_HSW_GT2_IDS
|
||||||
|
80860412
|
||||||
|
80860416
|
||||||
|
8086041A
|
||||||
|
8086041B
|
||||||
|
8086041E
|
||||||
|
80860C12
|
||||||
|
80860C16
|
||||||
|
80860C1A
|
||||||
|
80860C1B
|
||||||
|
80860C1E
|
||||||
|
80860D12
|
||||||
|
80860D16
|
||||||
|
80860D1A
|
||||||
|
80860D1B
|
||||||
|
80860D1E
|
||||||
|
# INTEL_HSW_ULT_GT3_IDS
|
||||||
|
80860A22
|
||||||
|
80860A26
|
||||||
|
80860A2A
|
||||||
|
80860A2B
|
||||||
|
80860A2E
|
||||||
|
# INTEL_HSW_GT3_IDS
|
||||||
|
80860422
|
||||||
|
80860426
|
||||||
|
8086042A
|
||||||
|
8086042B
|
||||||
|
8086042E
|
||||||
|
80860C22
|
||||||
|
80860C26
|
||||||
|
80860C2A
|
||||||
|
80860C2B
|
||||||
|
80860C2E
|
||||||
|
80860D22
|
||||||
|
80860D26
|
||||||
|
80860D2A
|
||||||
|
80860D2B
|
||||||
|
80860D2E
|
||||||
|
# INTEL_VLV_IDS
|
||||||
|
80860f30
|
||||||
|
80860f31
|
||||||
|
80860f32
|
||||||
|
80860f33
|
||||||
|
# INTEL_BDW_ULT_GT1_IDS
|
||||||
|
80861606
|
||||||
|
8086160B
|
||||||
|
# INTEL_BDW_ULX_GT1_IDS
|
||||||
|
8086160E
|
||||||
|
# INTEL_BDW_GT1_IDS
|
||||||
|
80861602
|
||||||
|
8086160A
|
||||||
|
8086160D
|
||||||
|
# INTEL_BDW_ULT_GT2_IDS
|
||||||
|
80861616
|
||||||
|
8086161B
|
||||||
|
# INTEL_BDW_ULX_GT2_IDS
|
||||||
|
8086161E
|
||||||
|
# INTEL_BDW_GT2_IDS
|
||||||
|
80861612
|
||||||
|
8086161A
|
||||||
|
8086161D
|
||||||
|
# INTEL_BDW_ULT_GT3_IDS
|
||||||
|
80861626
|
||||||
|
8086162B
|
||||||
|
# INTEL_BDW_ULX_GT3_IDS
|
||||||
|
8086162E
|
||||||
|
# INTEL_BDW_GT3_IDS
|
||||||
|
80861622
|
||||||
|
8086162A
|
||||||
|
8086162D
|
||||||
|
# INTEL_BDW_ULT_RSVD_IDS
|
||||||
|
80861636
|
||||||
|
8086163B
|
||||||
|
# INTEL_BDW_ULX_RSVD_IDS
|
||||||
|
8086163E
|
||||||
|
# INTEL_BDW_RSVD_IDS
|
||||||
|
80861632
|
||||||
|
8086163A
|
||||||
|
8086163D
|
||||||
|
# INTEL_CHV_IDS
|
||||||
|
808622b0
|
||||||
|
808622b1
|
||||||
|
808622b2
|
||||||
|
808622b3
|
||||||
|
# INTEL_SKL_ULT_GT1_IDS
|
||||||
|
80861906
|
||||||
|
80861913
|
||||||
|
# INTEL_SKL_ULX_GT1_IDS
|
||||||
|
8086190E
|
||||||
|
80861915
|
||||||
|
# INTEL_SKL_GT1_IDS
|
||||||
|
80861902
|
||||||
|
8086190A
|
||||||
|
8086190B
|
||||||
|
80861917
|
||||||
|
# INTEL_SKL_ULT_GT2_IDS
|
||||||
|
80861916
|
||||||
|
80861921
|
||||||
|
# INTEL_SKL_ULX_GT2_IDS
|
||||||
|
8086191E
|
||||||
|
# INTEL_SKL_GT2_IDS
|
||||||
|
80861912
|
||||||
|
8086191A
|
||||||
|
8086191B
|
||||||
|
8086191D
|
||||||
|
# INTEL_SKL_ULT_GT3_IDS
|
||||||
|
80861923
|
||||||
|
80861926
|
||||||
|
80861927
|
||||||
|
# INTEL_SKL_GT3_IDS
|
||||||
|
8086192A
|
||||||
|
8086192B
|
||||||
|
8086192D
|
||||||
|
# INTEL_SKL_GT4_IDS
|
||||||
|
80861932
|
||||||
|
8086193A
|
||||||
|
8086193B
|
||||||
|
8086193D
|
||||||
|
# INTEL_BXT_IDS
|
||||||
|
80860A84
|
||||||
|
80861A84
|
||||||
|
80861A85
|
||||||
|
80865A84
|
||||||
|
80865A85
|
||||||
|
# INTEL_GLK_IDS
|
||||||
|
80863184
|
||||||
|
80863185
|
||||||
|
# INTEL_KBL_ULT_GT1_IDS
|
||||||
|
80865906
|
||||||
|
80865913
|
||||||
|
# INTEL_KBL_ULX_GT1_IDS
|
||||||
|
8086590E
|
||||||
|
80865915
|
||||||
|
# INTEL_KBL_GT1_IDS
|
||||||
|
80865902
|
||||||
|
80865908
|
||||||
|
8086590A
|
||||||
|
8086590B
|
||||||
|
# INTEL_KBL_ULT_GT2_IDS
|
||||||
|
80865916
|
||||||
|
80865921
|
||||||
|
# INTEL_KBL_ULX_GT2_IDS
|
||||||
|
8086591E
|
||||||
|
# INTEL_KBL_GT2_IDS
|
||||||
|
80865912
|
||||||
|
80865917
|
||||||
|
8086591A
|
||||||
|
8086591B
|
||||||
|
8086591D
|
||||||
|
# INTEL_KBL_ULT_GT3_IDS
|
||||||
|
80865926
|
||||||
|
# INTEL_KBL_GT3_IDS
|
||||||
|
80865923
|
||||||
|
80865927
|
||||||
|
# INTEL_KBL_GT4_IDS
|
||||||
|
8086593B
|
||||||
|
# INTEL_AML_KBL_GT2_IDS
|
||||||
|
8086591C
|
||||||
|
808687C0
|
||||||
|
# INTEL_AML_CFL_GT2_IDS
|
||||||
|
808687CA
|
||||||
|
# INTEL_CML_GT1_IDS
|
||||||
|
80869BA2
|
||||||
|
80869BA4
|
||||||
|
80869BA5
|
||||||
|
80869BA8
|
||||||
|
# INTEL_CML_U_GT1_IDS
|
||||||
|
80869B21
|
||||||
|
80869BAA
|
||||||
|
80869BAC
|
||||||
|
# INTEL_CML_GT2_IDS
|
||||||
|
80869BC2
|
||||||
|
80869BC4
|
||||||
|
80869BC5
|
||||||
|
80869BC6
|
||||||
|
80869BC8
|
||||||
|
80869BE6
|
||||||
|
80869BF6
|
||||||
|
# INTEL_CML_U_GT2_IDS
|
||||||
|
80869B41
|
||||||
|
80869BCA
|
||||||
|
80869BCC
|
||||||
|
# INTEL_CFL_S_GT1_IDS
|
||||||
|
80863E90
|
||||||
|
80863E93
|
||||||
|
80863E99
|
||||||
|
# INTEL_CFL_S_GT2_IDS
|
||||||
|
80863E91
|
||||||
|
80863E92
|
||||||
|
80863E96
|
||||||
|
80863E98
|
||||||
|
80863E9A
|
||||||
|
# INTEL_CFL_H_GT1_IDS
|
||||||
|
80863E9C
|
||||||
|
# INTEL_CFL_H_GT2_IDS
|
||||||
|
80863E94
|
||||||
|
80863E9B
|
||||||
|
# INTEL_CFL_U_GT2_IDS
|
||||||
|
80863EA9
|
||||||
|
# INTEL_CFL_U_GT3_IDS
|
||||||
|
80863EA5
|
||||||
|
80863EA6
|
||||||
|
80863EA7
|
||||||
|
80863EA8
|
||||||
|
# INTEL_WHL_U_GT1_IDS
|
||||||
|
80863EA1
|
||||||
|
80863EA4
|
||||||
|
# INTEL_WHL_U_GT2_IDS
|
||||||
|
80863EA0
|
||||||
|
80863EA3
|
||||||
|
# INTEL_WHL_U_GT3_IDS
|
||||||
|
80863EA2
|
||||||
|
# INTEL_CNL_PORT_F_IDS
|
||||||
|
80865A44
|
||||||
|
80865A4C
|
||||||
|
80865A54
|
||||||
|
80865A5C
|
||||||
|
# INTEL_CNL_IDS
|
||||||
|
80865A40
|
||||||
|
80865A41
|
||||||
|
80865A42
|
||||||
|
80865A49
|
||||||
|
80865A4A
|
||||||
|
80865A50
|
||||||
|
80865A51
|
||||||
|
80865A52
|
||||||
|
80865A59
|
||||||
|
80865A5A
|
||||||
|
# INTEL_ICL_PORT_F_IDS
|
||||||
|
80868A50
|
||||||
|
80868A52
|
||||||
|
80868A53
|
||||||
|
80868A54
|
||||||
|
80868A56
|
||||||
|
80868A57
|
||||||
|
80868A58
|
||||||
|
80868A59
|
||||||
|
80868A5A
|
||||||
|
80868A5B
|
||||||
|
80868A5C
|
||||||
|
80868A70
|
||||||
|
80868A71
|
||||||
|
# INTEL_ICL_11_IDS
|
||||||
|
80868A51
|
||||||
|
80868A5D
|
||||||
|
# INTEL_EHL_IDS
|
||||||
|
80864541
|
||||||
|
80864551
|
||||||
|
80864555
|
||||||
|
80864557
|
||||||
|
80864570
|
||||||
|
80864571
|
||||||
|
# INTEL_JSL_IDS
|
||||||
|
80864E51
|
||||||
|
80864E55
|
||||||
|
80864E57
|
||||||
|
80864E61
|
||||||
|
80864E71
|
||||||
|
# INTEL_TGL_12_GT1_IDS
|
||||||
|
80869A60
|
||||||
|
80869A68
|
||||||
|
80869A70
|
||||||
|
# INTEL_TGL_12_GT2_IDS
|
||||||
|
80869A40
|
||||||
|
80869A49
|
||||||
|
80869A59
|
||||||
|
80869A78
|
||||||
|
80869AC0
|
||||||
|
80869AC9
|
||||||
|
80869AD9
|
||||||
|
80869AF8
|
||||||
|
# INTEL_RKL_IDS
|
||||||
|
80864C80
|
||||||
|
80864C8A
|
||||||
|
80864C8B
|
||||||
|
80864C8C
|
||||||
|
80864C90
|
||||||
|
80864C9A
|
||||||
|
# INTEL_DG1_IDS
|
||||||
|
80864905
|
||||||
|
80864906
|
||||||
|
80864907
|
||||||
|
80864908
|
||||||
|
80864909
|
||||||
|
# INTEL_ADLS_IDS
|
||||||
|
80864680
|
||||||
|
80864682
|
||||||
|
80864688
|
||||||
|
8086468A
|
||||||
|
8086468B
|
||||||
|
80864690
|
||||||
|
80864692
|
||||||
|
80864693
|
||||||
|
# INTEL_ADLP_IDS
|
||||||
|
808646A0
|
||||||
|
808646A1
|
||||||
|
808646A2
|
||||||
|
808646A3
|
||||||
|
808646A6
|
||||||
|
808646A8
|
||||||
|
808646AA
|
||||||
|
8086462A
|
||||||
|
80864626
|
||||||
|
80864628
|
||||||
|
808646B0
|
||||||
|
808646B1
|
||||||
|
808646B2
|
||||||
|
808646B3
|
||||||
|
808646C0
|
||||||
|
808646C1
|
||||||
|
808646C2
|
||||||
|
808646C3
|
||||||
|
# INTEL_ADLN_IDS
|
||||||
|
808646D0
|
||||||
|
808646D1
|
||||||
|
808646D2
|
||||||
|
# INTEL_RPLS_IDS
|
||||||
|
8086A780
|
||||||
|
8086A781
|
||||||
|
8086A782
|
||||||
|
8086A783
|
||||||
|
8086A788
|
||||||
|
8086A789
|
||||||
|
8086A78A
|
||||||
|
8086A78B
|
||||||
|
# INTEL_RPLU_IDS
|
||||||
|
8086A721
|
||||||
|
8086A7A1
|
||||||
|
8086A7A9
|
||||||
|
8086A7AC
|
||||||
|
8086A7AD
|
||||||
|
# INTEL_RPLP_IDS
|
||||||
|
8086A720
|
||||||
|
8086A7A0
|
||||||
|
8086A7A8
|
||||||
|
8086A7AA
|
||||||
|
8086A7AB
|
||||||
|
# INTEL_DG2_G10_IDS
|
||||||
|
80865690
|
||||||
|
80865691
|
||||||
|
80865692
|
||||||
|
808656A0
|
||||||
|
808656A1
|
||||||
|
808656A2
|
||||||
|
# INTEL_DG2_G11_IDS
|
||||||
|
80865693
|
||||||
|
80865694
|
||||||
|
80865695
|
||||||
|
808656A5
|
||||||
|
808656A6
|
||||||
|
808656B0
|
||||||
|
808656B1
|
||||||
|
808656BA
|
||||||
|
808656BB
|
||||||
|
808656BC
|
||||||
|
808656BD
|
||||||
|
# INTEL_DG2_G12_IDS
|
||||||
|
80865696
|
||||||
|
80865697
|
||||||
|
808656A3
|
||||||
|
808656A4
|
||||||
|
808656B2
|
||||||
|
808656B3
|
||||||
|
# INTEL_ATS_M150_IDS
|
||||||
|
808656C0
|
||||||
|
# INTEL_ATS_M75_IDS
|
||||||
|
808656C1
|
||||||
|
# INTEL_MTL_IDS
|
||||||
|
80867D40
|
||||||
|
80867D45
|
||||||
|
80867D55
|
||||||
|
80867D60
|
||||||
|
80867D67
|
||||||
|
80867DD5
|
62
i915/install.sh
Executable file
62
i915/install.sh
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
PLATFORMS="apollolake geminilake"
|
||||||
|
PLATFORM="$(/bin/get_key_value /etc.defaults/synoinfo.conf unique | cut -d"_" -f2)"
|
||||||
|
if ! echo "${PLATFORM}" | grep -qw "${PLATFORM}"; then
|
||||||
|
echo "${PLATFORM} is not supported i915 addon!"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1}" = "patches" ]; then
|
||||||
|
echo "Installing addon i915 - ${1}"
|
||||||
|
|
||||||
|
if [ -n "${2}" ]; then
|
||||||
|
GPU="$(echo "${2}" | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||||
|
else
|
||||||
|
GPU="$(lspci -n 2>/dev/null | grep 0300 | grep 8086 | cut -d " " -f 3 | sed 's/://g')"
|
||||||
|
if [ -z "${GPU}" ]; then
|
||||||
|
GPU="$(lspci -n 2>/dev/null | grep 0380 | grep 8086 | cut -d " " -f 3 | sed 's/://g')"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
[ -z "${GPU}" -o $(echo -n "${GPU}" | wc -c) -ne 8 ] && echo "GPU is not detected" && exit 0
|
||||||
|
|
||||||
|
KO_FILE="/usr/lib/modules/i915.ko"
|
||||||
|
[ ! -f "${KO_FILE}" ] && echo "i915.ko does not exist" && exit 0
|
||||||
|
|
||||||
|
if [ -n "${2}" ] || grep -iq ${GPU} "/addons/i915ids" 2>/dev/null; then
|
||||||
|
isLoad=0
|
||||||
|
if lsmod 2>/dev/null | grep -q ^i915; then
|
||||||
|
isLoad=1
|
||||||
|
rmmod i915
|
||||||
|
fi
|
||||||
|
GPU_DEF="86800000923e0000"
|
||||||
|
GPU_BIN="${GPU:2:2}${GPU:0:2}0000${GPU:6:2}${GPU:4:2}0000"
|
||||||
|
echo "GPU:${GPU} GPU_BIN:${GPU_BIN}"
|
||||||
|
cp -vf "${KO_FILE}" "${KO_FILE}.bak"
|
||||||
|
cp -f "${KO_FILE}" "${KO_FILE}.tmp"
|
||||||
|
xxd -c $(xxd -p "${KO_FILE}.tmp" 2>/dev/null | wc -c) -p "${KO_FILE}.tmp" 2>/dev/null |
|
||||||
|
sed "s/${GPU_DEF}/${GPU_BIN}/; s/308201f706092a86.*70656e6465647e0a//" |
|
||||||
|
xxd -r -p >"${KO_FILE}" 2>/dev/null
|
||||||
|
rm -f "${KO_FILE}.tmp"
|
||||||
|
[ "${isLoad}" = "1" ] && /usr/sbin/modprobe "/usr/lib/modules/i915.ko"
|
||||||
|
fi
|
||||||
|
elif [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon i915 - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
KO_FILE="/tmpRoot/usr/lib/modules/i915.ko"
|
||||||
|
[ ! -f "${KO_FILE}.bak" ] && cp -vf "${KO_FILE}" "${KO_FILE}.bak"
|
||||||
|
cp -vf "/usr/lib/modules/i915.ko" "${KO_FILE}"
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon i915 - ${1}"
|
||||||
|
|
||||||
|
KO_FILE="/tmpRoot/usr/lib/modules/i915.ko"
|
||||||
|
[ -f "${KO_FILE}.bak" ] && mv -f "${KO_FILE}.bak" "${KO_FILE}"
|
||||||
|
fi
|
19
i915/manifest.yml
Executable file
19
i915/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: i915
|
||||||
|
description: "Automatically replace the device ID of i915.ko, up to 10th Gen. (apollolake, geminilake)"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: false
|
||||||
|
broadwellnk: false
|
||||||
|
broadwellnkv2: false
|
||||||
|
broadwellntbap: false
|
||||||
|
denverton: false
|
||||||
|
geminilake: true
|
||||||
|
purley: false
|
||||||
|
v1000: false
|
||||||
|
r1000: false
|
||||||
|
epyc7002: false
|
BIN
localrss/all/usr/bin/sed
Executable file
BIN
localrss/all/usr/bin/sed
Executable file
Binary file not shown.
97
localrss/install.sh
Executable file
97
localrss/install.sh
Executable file
@ -0,0 +1,97 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# External incoming required ${MLINK} and ${MCHECKSUM}
|
||||||
|
if [ -z "${MLINK}" -o -z "${MCHECKSUM}" ]; then
|
||||||
|
echo "MLINK or MCHECKSUM is null"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1}" = "modules" ]; then
|
||||||
|
echo "Installing addon localrss - ${1}"
|
||||||
|
|
||||||
|
# MajorVersion=`/bin/get_key_value /etc.defaults/VERSION majorversion`
|
||||||
|
# MinorVersion=`/bin/get_key_value /etc.defaults/VERSION minorversion`
|
||||||
|
. /etc.defaults/VERSION
|
||||||
|
|
||||||
|
cat >/usr/syno/web/localrss.json <<EOF
|
||||||
|
{
|
||||||
|
"version": "2.0",
|
||||||
|
"channel": {
|
||||||
|
"title": "RSS for DSM Auto Update",
|
||||||
|
"link": "https://update.synology.com/autoupdate/v2/getList",
|
||||||
|
"pubDate": "Sat Aug 6 0:18:39 CST 2022",
|
||||||
|
"copyright": "Copyright 2022 Synology Inc",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"title": "DSM ${productversion}-${buildnumber}",
|
||||||
|
"MajorVer": ${major},
|
||||||
|
"MinorVer": ${minor},
|
||||||
|
"NanoVer": ${micro},
|
||||||
|
"BuildPhase": "${buildphase}",
|
||||||
|
"BuildNum": ${buildnumber},
|
||||||
|
"BuildDate": "${builddate}",
|
||||||
|
"ReqMajorVer": ${major},
|
||||||
|
"ReqMinorVer": 0,
|
||||||
|
"ReqBuildPhase": 0,
|
||||||
|
"ReqBuildNum": 0,
|
||||||
|
"ReqBuildDate": "${builddate}",
|
||||||
|
"isSecurityVersion": false,
|
||||||
|
"model": [
|
||||||
|
{
|
||||||
|
"mUnique": "${unique}",
|
||||||
|
"mLink": "${MLINK}",
|
||||||
|
"mCheckSum": "${MCHECKSUM}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >/usr/syno/web/localrss.xml <<EOF
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title>RSS for DSM Auto Update</title>
|
||||||
|
<link>http://update.synology.com/autoupdate/genRSS.php</link>
|
||||||
|
<pubDate>Tue May 9 11:52:15 CST 2023</pubDate>
|
||||||
|
<copyright>Copyright 2023 Synology Inc</copyright>
|
||||||
|
<item>
|
||||||
|
<title>DSM ${productversion}-${buildnumber}</title>
|
||||||
|
<MajorVer>${major}</MajorVer>
|
||||||
|
<MinorVer>${minor}</MinorVer>
|
||||||
|
<BuildPhase>${buildphase}</BuildPhase>
|
||||||
|
<BuildNum>${buildnumber}</BuildNum>
|
||||||
|
<BuildDate>${builddate}</BuildDate>
|
||||||
|
<ReqMajorVer>${major}</ReqMajorVer>
|
||||||
|
<ReqMinorVer>0</ReqMinorVer>
|
||||||
|
<ReqBuildPhase>0</ReqBuildPhase>
|
||||||
|
<ReqBuildNum>0</ReqBuildNum>
|
||||||
|
<ReqBuildDate>${builddate}</ReqBuildDate>
|
||||||
|
<model>
|
||||||
|
<mUnique>${unique}</mUnique>
|
||||||
|
<mLink>${MLINK}</mLink>
|
||||||
|
<mCheckSum>${MCHECKSUM}</mCheckSum>
|
||||||
|
</model>
|
||||||
|
</item>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ -f /usr/syno/web/localrss.xml ]; then
|
||||||
|
cat /usr/syno/web/localrss.xml
|
||||||
|
sed -i "s|rss_server=.*$|rss_server=\"http://localhost:5000/localrss.xml\"|g" "/etc/synoinfo.conf" "/etc.defaults/synoinfo.conf"
|
||||||
|
sed -i "s|rss_server_ssl=.*$|rss_server_ssl=\"http://localhost:5000/localrss.xml\"|g" "/etc/synoinfo.conf" "/etc.defaults/synoinfo.conf"
|
||||||
|
fi
|
||||||
|
if [ -f /usr/syno/web/localrss.json ]; then
|
||||||
|
cat /usr/syno/web/localrss.json
|
||||||
|
sed -i "s|rss_server_v2=.*$|rss_server_v2=\"http://localhost:5000/localrss.json\"|g" "/etc/synoinfo.conf" "/etc.defaults/synoinfo.conf"
|
||||||
|
fi
|
||||||
|
fi
|
19
localrss/manifest.yml
Executable file
19
localrss/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: localrss
|
||||||
|
description: "rss for bootloader pat"
|
||||||
|
system: true
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
BIN
lsiutil/all/usr/sbin/lsiutil
Executable file
BIN
lsiutil/all/usr/sbin/lsiutil
Executable file
Binary file not shown.
19
lsiutil/install.sh
Executable file
19
lsiutil/install.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${1}" = "late" ]; then
|
||||||
|
echo "Installing addon lsiutil - ${1}"
|
||||||
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||||
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||||
|
|
||||||
|
cp -vf /usr/sbin/lsiutil /tmpRoot/usr/sbin/lsiutil
|
||||||
|
elif [ "${1}" = "uninstall" ]; then
|
||||||
|
echo "Installing addon lsiutil - ${1}"
|
||||||
|
|
||||||
|
rm -f "/tmpRoot/usr/sbin/lsiutil"
|
||||||
|
fi
|
19
lsiutil/manifest.yml
Executable file
19
lsiutil/manifest.yml
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
version: 1
|
||||||
|
name: lsiutil
|
||||||
|
description: "A tool for working with some LSI RAID controllers"
|
||||||
|
system: false
|
||||||
|
beta: false
|
||||||
|
all:
|
||||||
|
install-script: "install.sh"
|
||||||
|
copy: "all"
|
||||||
|
apollolake: true
|
||||||
|
broadwell: true
|
||||||
|
broadwellnk: true
|
||||||
|
broadwellnkv2: true
|
||||||
|
broadwellntbap: true
|
||||||
|
denverton: true
|
||||||
|
geminilake: true
|
||||||
|
purley: true
|
||||||
|
v1000: true
|
||||||
|
r1000: true
|
||||||
|
epyc7002: true
|
BIN
misc/all/addons/esynoscheduler.db
Normal file
BIN
misc/all/addons/esynoscheduler.db
Normal file
Binary file not shown.
53
misc/all/addons/web_index.html
Normal file
53
misc/all/addons/web_index.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de" style="--light-subtabs-background: rgba(94,114,228,0.15); --dark_webkit-any-link: rgb(112,104,159);">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<title>Arc Recovery</title>
|
||||||
|
<meta content="width=device-width" name="viewport">
|
||||||
|
<meta name="format-detection" content="telephone=no, email=no">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="x5-fullscreen" content="true">
|
||||||
|
<meta name="full-screen" content="yes">
|
||||||
|
<meta name="x5-page-mode" content="app">
|
||||||
|
<meta name="browsermode" content="application">
|
||||||
|
<meta name="msapplication-tap-highlight" content="no">
|
||||||
|
<meta name="msapplication-TileColor" content="#5e72e4">
|
||||||
|
<meta name="msapplication-TileColor" content="#5e72e4">
|
||||||
|
<meta name="theme-color" content="#5e72e4">
|
||||||
|
|
||||||
|
<style title="text/css">
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
body {
|
||||||
|
background: #2c2c2c;
|
||||||
|
color: #cccccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="Arc">
|
||||||
|
<div class="cbi-map" style="display: grid; grid-template-columns: 1fr 1fr;">
|
||||||
|
<iframe id="ttyd" style="width: 100%;" src="" height="1594"></iframe>
|
||||||
|
<iframe id="dufs" style="width: 100%;" src="" height="1594"></iframe>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.getElementById("ttyd").src = window.location.protocol + "//" + window.location.hostname + ":7681";
|
||||||
|
document.getElementById("dufs").src = window.location.protocol + "//" + window.location.hostname + ":7304";
|
||||||
|
document.getElementById("ttyd").height = document.documentElement.clientHeight - 60;
|
||||||
|
document.getElementById("dufs").height = document.documentElement.clientHeight - 60;
|
||||||
|
window.onresize = function () {
|
||||||
|
document.getElementById("ttyd").height = document.documentElement.clientHeight - 60;
|
||||||
|
document.getElementById("dufs").height = document.documentElement.clientHeight - 60;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p style="position: fixed; bottom: 0; width: 100%; text-align: center; padding: 5px 0;">
|
||||||
|
© 2024 Arc Loader Recovery by <a href="https://github.com/AuxXxilium" target="_blank">AuxXxilium</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
BIN
misc/all/usr/bin/awk
Executable file
BIN
misc/all/usr/bin/awk
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/bc
Executable file
BIN
misc/all/usr/bin/bc
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/cp
Executable file
BIN
misc/all/usr/bin/cp
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/cpio
Executable file
BIN
misc/all/usr/bin/cpio
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/diff
Executable file
BIN
misc/all/usr/bin/diff
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/dtc
Executable file
BIN
misc/all/usr/bin/dtc
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/ethtool
Executable file
BIN
misc/all/usr/bin/ethtool
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/find
Executable file
BIN
misc/all/usr/bin/find
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/gawk
Executable file
BIN
misc/all/usr/bin/gawk
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/grub-editenv
Executable file
BIN
misc/all/usr/bin/grub-editenv
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/gzip
Executable file
BIN
misc/all/usr/bin/gzip
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/jq
Executable file
BIN
misc/all/usr/bin/jq
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/kmod
Executable file
BIN
misc/all/usr/bin/kmod
Executable file
Binary file not shown.
50
misc/all/usr/bin/loader-reboot.sh
Executable file
50
misc/all/usr/bin/loader-reboot.sh
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env ash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the MIT License.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Sanity checks
|
||||||
|
if [ ! ${USER} = "root" ]; then
|
||||||
|
exec sudo $0 $@
|
||||||
|
fi
|
||||||
|
|
||||||
|
MODES="config recovery junior automated update"
|
||||||
|
|
||||||
|
function use() {
|
||||||
|
echo "Use: ${0} [${MODES// /|}]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "${1}" ] || ! echo "${MODES}" | grep -qw "${1}"; then use; fi
|
||||||
|
|
||||||
|
echo "Rebooting to ${1} mode"
|
||||||
|
|
||||||
|
echo 1 >/proc/sys/kernel/syno_install_flag 2>/dev/null
|
||||||
|
mkdir -p /mnt/p1
|
||||||
|
mount | grep -q /dev/synoboot1 || mount /dev/synoboot1 /mnt/p1 2>/dev/null
|
||||||
|
|
||||||
|
GRUBPATH="$(dirname $(find /mnt/p1 -name grub.cfg | head -1))"
|
||||||
|
if [ -z "${GRUBPATH}" ]; then
|
||||||
|
echo "Error: GRUB path not found"
|
||||||
|
umount /mnt/p1 2>/dev/null
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ENVFILE="${GRUBPATH}/grubenv"
|
||||||
|
|
||||||
|
if grub-editenv --help >/dev/null 2>&1; then
|
||||||
|
[ ! -f "${ENVFILE}" ] && grub-editenv ${ENVFILE} create
|
||||||
|
grub-editenv ${ENVFILE} set next_entry="${1}"
|
||||||
|
else
|
||||||
|
echo "# GRUB Environment Block" >${ENVFILE}
|
||||||
|
echo "# WARNING: Do not edit this file by tools other than grub-editenv!!!" >>${ENVFILE}
|
||||||
|
echo "next_entry=${1}" >>${ENVFILE}
|
||||||
|
printf '%*s' 930 | tr ' ' '#' >>${ENVFILE}
|
||||||
|
fi
|
||||||
|
sync
|
||||||
|
umount /mnt/p1 2>/dev/null
|
||||||
|
|
||||||
|
[ -x /usr/syno/sbin/synopoweroff ] && /usr/syno/sbin/synopoweroff -r || reboot
|
BIN
misc/all/usr/bin/lsof
Executable file
BIN
misc/all/usr/bin/lsof
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/lspci
Executable file
BIN
misc/all/usr/bin/lspci
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/mv
Executable file
BIN
misc/all/usr/bin/mv
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/pup
Executable file
BIN
misc/all/usr/bin/pup
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/readlink
Executable file
BIN
misc/all/usr/bin/readlink
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/realpath
Executable file
BIN
misc/all/usr/bin/realpath
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/rm
Executable file
BIN
misc/all/usr/bin/rm
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/sed
Executable file
BIN
misc/all/usr/bin/sed
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/sort
Executable file
BIN
misc/all/usr/bin/sort
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/stat
Executable file
BIN
misc/all/usr/bin/stat
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/stty
Executable file
BIN
misc/all/usr/bin/stty
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/tr
Executable file
BIN
misc/all/usr/bin/tr
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/tty
Executable file
BIN
misc/all/usr/bin/tty
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/unzip
Executable file
BIN
misc/all/usr/bin/unzip
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/xxd
Executable file
BIN
misc/all/usr/bin/xxd
Executable file
Binary file not shown.
BIN
misc/all/usr/bin/yq
Executable file
BIN
misc/all/usr/bin/yq
Executable file
Binary file not shown.
BIN
misc/all/usr/lib/libattr.so.1
Executable file
BIN
misc/all/usr/lib/libattr.so.1
Executable file
Binary file not shown.
BIN
misc/all/usr/lib/libblkid.so
Executable file
BIN
misc/all/usr/lib/libblkid.so
Executable file
Binary file not shown.
BIN
misc/all/usr/lib/libblkid.so.1
Executable file
BIN
misc/all/usr/lib/libblkid.so.1
Executable file
Binary file not shown.
BIN
misc/all/usr/lib/libblkid.so.1.1.0
Executable file
BIN
misc/all/usr/lib/libblkid.so.1.1.0
Executable file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user