ashmem-driver.plg hinzugefügt
This commit is contained in:
179
ashmem-driver.plg
Normal file
179
ashmem-driver.plg
Normal file
@@ -0,0 +1,179 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "ashmem-driver">
|
||||
<!ENTITY author "ich777">
|
||||
<!ENTITY version "2025.04.04">
|
||||
<!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master">
|
||||
<!ENTITY pluginURL "&gitURL;/&name;.plg">
|
||||
<!ENTITY plugin "/boot/config/plugins/&name;">
|
||||
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
|
||||
<!ENTITY packages "/boot/config/plugins/&name;/packages">
|
||||
]>
|
||||
|
||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="7.1.0-beta.2.2">
|
||||
|
||||
<CHANGES>
|
||||
|
||||
###2025.04.04
|
||||
- Initial release
|
||||
|
||||
</CHANGES>
|
||||
|
||||
<FILE Run="/bin/bash">
|
||||
<INLINE>
|
||||
rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null|grep -v '&version;')
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<FILE Name="&emhttp;/README.md">
|
||||
<INLINE>
|
||||
**ashmem Driver**
|
||||
|
||||
ashmem (Anonymous Shared Memory Subsystem for Android) is a new shared memory allocator, similar to POSIX SHM but with different behavior and sporting a simpler file-based API.
|
||||
|
||||
Source: https://github.com/choff/anbox-modules
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<FILE Run="/bin/bash">
|
||||
<INLINE>
|
||||
|
||||
download() {
|
||||
#Download ashmem Driver
|
||||
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; then
|
||||
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5" "${DL_URL}/${LAT_PACKAGE}.md5"
|
||||
if [ "$(md5sum &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE} | awk '{print $1}')" != "$(cat &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5 | awk '{print $1}')" ]; then
|
||||
echo
|
||||
echo "---CHECKSUM ERROR!---"
|
||||
rm -rf &plugin; &emhttp;
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
echo "-------------------Sucessfully downloaded ashmem Driver-------------------"
|
||||
else
|
||||
echo
|
||||
echo "-----------------------Can't download ashmem Driver-----------------------"
|
||||
rm -rf &plugin; &emhttp;
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check() {
|
||||
if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
|
||||
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-ashmem-driver/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
|
||||
echo
|
||||
echo "-----------------------Downloading ashmem Driver!-------------------------"
|
||||
echo "-------This could take some time, please don't close this window!---------"
|
||||
download
|
||||
else
|
||||
echo
|
||||
echo "-----------------------ashmem Driver found locally------------------------"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
#Install ashmem Driver
|
||||
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
|
||||
depmod -a
|
||||
}
|
||||
|
||||
activate() {
|
||||
/sbin/modprobe ashmem_linux
|
||||
}
|
||||
|
||||
# Define Variables
|
||||
KERNEL_V="$(uname -r)"
|
||||
PACKAGE="ashmem"
|
||||
DL_URL="https://github.com/ich777/unraid-ashmem-driver/releases/download/$KERNEL_V"
|
||||
|
||||
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then
|
||||
mkdir -p "&packages;/${KERNEL_V%%-*}"
|
||||
fi
|
||||
|
||||
#Check for old packages
|
||||
rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}")
|
||||
|
||||
#Check if ashmem Driver are already downloaded
|
||||
check
|
||||
|
||||
if ! modinfo ashmem_linux -0 >/dev/null 2>&1 ; then
|
||||
install > /dev/null
|
||||
activate
|
||||
else
|
||||
activate
|
||||
fi
|
||||
|
||||
#Install icon
|
||||
if [ ! -f "&emhttp;/images/&name;.png" ]; then
|
||||
if [ ! -d "&emhttp;/images" ]; then
|
||||
mkdir -p &emhttp;/images
|
||||
fi
|
||||
cp &plugin;/&name;.png &emhttp;/images/
|
||||
fi
|
||||
|
||||
|
||||
#Check if Plugin Update Helper is downloaded and up-to-date
|
||||
if [ ! -f &plugin;/plugin_update_helper ]; then
|
||||
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
||||
else
|
||||
CUR_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
||||
if [ ! -s /tmp/update-helper ]; then
|
||||
echo "$(wget -T5 -qO- https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper | grep -E "Plugin-Update-Helper version:" | awk '{print $4}')" > /tmp/update-helper
|
||||
AVAIL_V="$(cat /tmp/update-helper)"
|
||||
else
|
||||
AVAIL_V="$(cat /tmp/update-helper)"
|
||||
fi
|
||||
if [ ! -z "$AVAIL_V" ]; then
|
||||
COMPARE="$(sort -V <(echo -e "${AVAIL_V}\n$CUR_V") | tail -1)"
|
||||
if [ "$CUR_V" != "$COMPARE" ]; then
|
||||
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#Check if Plugin Update Helper is installed and up to date
|
||||
if [ ! -f /usr/bin/plugin_update_helper ]; then
|
||||
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
||||
chmod +x /usr/bin/plugin_update_helper
|
||||
else
|
||||
PLUGIN_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
||||
INST_V="$(grep -E "Plugin-Update-Helper version:" /usr/bin/plugin_update_helper | awk '{print $4}')"
|
||||
COMPARE="$(sort -V <(echo -e "${PLUGIN_V}\n$INST_V") | tail -1)"
|
||||
if [ "$INST_V" != "$COMPARE" ]; then
|
||||
kill $(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}') 2>/dev/null
|
||||
sleep 1
|
||||
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
||||
chmod +x /usr/bin/plugin_update_helper
|
||||
fi
|
||||
fi
|
||||
|
||||
#Start Plugin Update Helper
|
||||
if [ -z "$(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}')" ]; then
|
||||
echo "/usr/bin/plugin_update_helper" | at now > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "----------------Installation of ashmem Driver successful------------------"
|
||||
echo
|
||||
|
||||
</INLINE>
|
||||
</FILE>
|
||||
|
||||
<FILE Run="/bin/bash" Method="remove">
|
||||
<INLINE>
|
||||
|
||||
echo "--------------------------------"
|
||||
echo "---Uninstalling ashmem Driver---"
|
||||
echo "--------------------------------"
|
||||
# Remove plugin related files
|
||||
rm -rf &plugin; &emhttp;
|
||||
echo
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "---ashmem Driver uninstalled, please reboot your server!---"
|
||||
echo "-----------------------------------------------------------"
|
||||
echo
|
||||
|
||||
</INLINE>
|
||||
</FILE>
|
||||
</PLUGIN>
|
Reference in New Issue
Block a user