Skip to content

Commit

Permalink
Merge pull request #182 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AuxXxilium authored Nov 20, 2023
2 parents e6ede09 + b03441f commit 6ae1869
Show file tree
Hide file tree
Showing 298 changed files with 4,471 additions and 75 deletions.
Empty file modified .github/FUNDING.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/build.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/update.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified acpid/manifest.yml
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions addincards/all/usr/sbin/addincards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/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.

model="$(cat /proc/sys/kernel/syno_hw_version)"

# adapter_cards.conf
FILE="/usr/syno/etc.defaults/adapter_cards.conf"
[ ! -f "${FILE}.bak" ] && cp -f "${FILE}" "${FILE}.bak"
rm -f ${FILE}
for N in `cat "${FILE}.bak" | grep '\['`; do
echo "${N}" >> "${FILE}"
echo "${model}=yes" >> "${FILE}"
done
chmod a+rx "${FILE}"
cp -f "${FILE}" "${FILE/\.defaults/}"

exit 0
22 changes: 22 additions & 0 deletions addincards/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env ash

if [ "${1}" = "late" ]; then
echo "Installing daemon for Addincards"
cp -vf /usr/sbin/addincards.sh /tmpRoot/usr/sbin/addincards.sh

DEST="/tmpRoot/lib/systemd/system/addincards.service"
echo "[Unit]" >${DEST}
echo "Description=update Add-in cards and usb.map" >>${DEST}
echo "After=multi-user.target" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "Type=oneshot" >>${DEST}
echo "RemainAfterExit=true" >>${DEST}
echo "ExecStart=/usr/sbin/addincards.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/addincards.service /tmpRoot/lib/systemd/system/multi-user.target.wants/addincards.service
fi
27 changes: 27 additions & 0 deletions addincards/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 1
name: addincards
description: "Remove the Modelrestrictions on official Addin Cards."
all:
install-script: "install.sh"
copy: "all"
available-for:
apollolake-4.4.180:
broadwell-4.4.180:
broadwellnk-4.4.180:
broadwellnkv2-4.4.180:
broadwellntbap-4.4.180:
denverton-4.4.180:
geminilake-4.4.180:
purley-4.4.180:
v1000-4.4.180:
r1000-4.4.180:
apollolake-4.4.302:
broadwell-4.4.302:
broadwellnk-4.4.302:
broadwellnkv2-4.4.302:
broadwellntbap-4.4.302:
denverton-4.4.302:
geminilake-4.4.302:
purley-4.4.302:
v1000-4.4.302:
r1000-4.4.302:
File renamed without changes.
Binary file added amepatch/all/usr/bin/xxd
Binary file not shown.
62 changes: 62 additions & 0 deletions amepatch/all/usr/sbin/amepatch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

if [ -d "/var/packages/CodecPack" ]; then
/usr/syno/bin/synopkg stop CodecPack
sleep 10

. /etc.defaults/VERSION

values=('669066909066906690' 'B801000000' '30')
indices=(0 1 1 1 1 2)
cp_usr_path="/var/packages/CodecPack/target/usr"
so="$cp_usr_path/lib/libsynoame-license.so"
lic="/usr/syno/etc/license/data/ame/offline_license.json"
licsig="/usr/syno/etc/license/data/ame/offline_license.sig"

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}")"
echo "${content}" >"${lic}"

if "${cp_usr_path}/bin/synoame-bin-check-license"; then
/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
${cp_usr_path}/bin/synoame-bin-auto-install-needed-codec
echo -e "AME Patch: Successful!"
else
echo -e "AME Patch: Unsuccessful!"
exit 1
fi

sleep 3
/usr/syno/bin/synopkg start CodecPack
fi

exit 0
20 changes: 20 additions & 0 deletions amepatch/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env ash

if [ "${1}" = "late" ]; then
echo "Creating service to exec Enable AME Patch"
cp -vf /usr/sbin/amepatch.sh /tmpRoot/usr/sbin/amepatch.sh
DEST="/tmpRoot/lib/systemd/system/amepatch.service"
echo "[Unit]" >${DEST}
echo "Description=Enable AME Patch" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "Type=oneshot" >>${DEST}
echo "RemainAfterExit=true" >>${DEST}
echo "ExecStart=/usr/sbin/amepatch.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/amepatch.service /tmpRoot/lib/systemd/system/multi-user.target.wants/amepatch.service
fi
28 changes: 28 additions & 0 deletions amepatch/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 1
name: amepatch
beta: false
description: "Dynamic Licensepatch for AME"
all:
install-script: "install.sh"
copy: "all"
available-for:
apollolake-4.4.180:
broadwell-4.4.180:
broadwellnk-4.4.180:
broadwellnkv2-4.4.180:
broadwellntbap-4.4.180:
denverton-4.4.180:
geminilake-4.4.180:
purley-4.4.180:
v1000-4.4.180:
r1000-4.4.180:
apollolake-4.4.302:
broadwell-4.4.302:
broadwellnk-4.4.302:
broadwellnkv2-4.4.302:
broadwellntbap-4.4.302:
denverton-4.4.302:
geminilake-4.4.302:
purley-4.4.302:
v1000-4.4.302:
r1000-4.4.302:
Loading

0 comments on commit 6ae1869

Please sign in to comment.