arc-addons/nvmevolume/install.sh

24 lines
904 B
Bash
Raw Normal View History

#!/usr/bin/env bash
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# From: https://github.com/PeterSuh-Q3/tcrp-addons/blob/main/nvmevolume-onthefly/src/install.sh
#
if [ "${1}" = "late" ]; then
echo "Installing addon nvmevolume - ${1}"
mkdir -p "/tmpRoot/usr/arc/addons/"
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
SO_FILE="/tmpRoot/usr/lib/libhwcontrol.so.1"
[ ! -f "${SO_FILE}.bak" ] && cp -vf "${SO_FILE}" "${SO_FILE}.bak"
cp -f "${SO_FILE}" "${SO_FILE}.tmp"
xxd -c $(xxd -p "${SO_FILE}.tmp" | wc -c) -p "${SO_FILE}.tmp" | sed "s/803e00b8010000007524488b/803e00b8010000009090488b/" | xxd -r -p > "${SO_FILE}"
rm -f "${SO_FILE}.tmp"
elif [ "${1}" = "uninstall" ]; then
echo "Installing addon nvmevolume - ${1}"
SO_FILE="/tmpRoot/usr/lib/libhwcontrol.so.1"
[ -f "${SO_FILE}.bak" ] && mv -f "${SO_FILE}.bak" "${SO_FILE}"
fi