Update postinst
This commit is contained in:
@@ -1,21 +1,35 @@
|
||||
#!/bin/ash
|
||||
|
||||
# Define the package name
|
||||
# Define the package name for the main package
|
||||
PKG_NAME="sdxpinn-mount-fix"
|
||||
|
||||
# Define the list file location
|
||||
LIST_FILE="/usr/lib/opkg/info/${PKG_NAME}.list"
|
||||
|
||||
# Replace distfeeds.conf with non-working sources commented out
|
||||
# Check if the temporary distfeeds.conf file exists
|
||||
if [ -f /tmp/distfeeds.conf ]; then
|
||||
# Backup the existing /etc/opkg/distfeeds.conf if it exists
|
||||
if [ -f /etc/opkg/distfeeds.conf ]; then
|
||||
cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.bak
|
||||
echo "Backed up original /etc/opkg/distfeeds.conf to /etc/opkg/distfeeds.conf.bak"
|
||||
# Function to handle bundled packages post-install
|
||||
handle_bundled_postinst() {
|
||||
local bundled_package="$1"
|
||||
|
||||
# Use the target package name for default_postinst instead of $0
|
||||
if [ "${IPKG_NO_SCRIPT}" = "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Move the new distfeeds.conf from /tmp to /etc/opkg
|
||||
# Source the necessary functions only once
|
||||
if [ -s "${IPKG_INSTROOT}/lib/functions.sh" ]; then
|
||||
. "${IPKG_INSTROOT}/lib/functions.sh"
|
||||
else
|
||||
echo "Error: ${IPKG_INSTROOT}/lib/functions.sh not found."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Executing default_postinst for bundled package: $bundled_package"
|
||||
default_postinst "$bundled_package" $@
|
||||
return $?
|
||||
}
|
||||
|
||||
# Replace distfeeds.conf with non-working sources commented out
|
||||
if [ -f /tmp/distfeeds.conf ]; then
|
||||
# Backup and replace distfeeds.conf
|
||||
[ -f /etc/opkg/distfeeds.conf ] && cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.bak
|
||||
mv /tmp/distfeeds.conf /etc/opkg/distfeeds.conf
|
||||
echo "Replaced /etc/opkg/distfeeds.conf with the custom version."
|
||||
else
|
||||
@@ -25,57 +39,37 @@ fi
|
||||
|
||||
echo "Combo package cleanup in progress..."
|
||||
|
||||
# Check if the .list file exists and modify it
|
||||
# Remove entries in the .list file that refer to opkg control files
|
||||
if [ -f "$LIST_FILE" ]; then
|
||||
# Remove any lines that start with /usr/lib/opkg/info/
|
||||
sed -i '/^\/usr\/lib\/opkg\/info\//d' "$LIST_FILE"
|
||||
echo "Removed control file entries from $LIST_FILE."
|
||||
else
|
||||
echo "Warning: ${LIST_FILE} not found."
|
||||
fi
|
||||
|
||||
# Make the init scripts and binaries executable
|
||||
chmod +x /etc/init.d/mount-fix /etc/init.d/init-overlay-watchdog /usr/sbin/init-overlay-watchdog.sh
|
||||
|
||||
# Make the init script executable
|
||||
chmod +x /etc/init.d/mount-fix
|
||||
chmod +x /etc/init.d/init-overlay-watchdog
|
||||
chmod +x /usr/sbin/init-overlay-watchdog.sh
|
||||
|
||||
# Enable and start the service
|
||||
# Enable and start the services
|
||||
echo "Starting services..."
|
||||
service mount-fix enable
|
||||
service mount-fix start
|
||||
sleep 1
|
||||
service init-overlay-watchdog enable
|
||||
service init-overlay-watchdog start
|
||||
|
||||
echo -e "\e[32m sdxpinn-mount-fix installed! Here is the new file structure! \e[0m"
|
||||
echo -e "\e[32m ============================================================ \e[0m"
|
||||
mount && df -h
|
||||
echo -e "\e[32m ============================================================ \e[0m"
|
||||
echo -e "\e[32m sdxpinn-mount-fix installed! New file structure above! \e[0m"
|
||||
|
||||
# Define the target bundled package name for this script
|
||||
BUNDLED_PACKAGE_NAME_1="libinotifytools"
|
||||
# Handle bundled packages
|
||||
BUNDLED_PACKAGES=("libinotifytools" "inotifywait")
|
||||
|
||||
# Check if the IPKG_NO_SCRIPT flag is set or if the required functions script is missing
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
|
||||
|
||||
# Source the necessary functions
|
||||
. ${IPKG_INSTROOT}/lib/functions.sh
|
||||
|
||||
# Use the target package name for default_postinst instead of $0
|
||||
default_postinst "${BUNDLED_PACKAGE_NAME_1}" $@
|
||||
|
||||
# Define the target bundled package name for this script
|
||||
BUNDLED_PACKAGE_NAME_2="inotifywait"
|
||||
|
||||
# Check if the IPKG_NO_SCRIPT flag is set or if the required functions script is missing
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0
|
||||
|
||||
# Source the necessary functions
|
||||
. ${IPKG_INSTROOT}/lib/functions.sh
|
||||
|
||||
# Use the target package name for default_postinst instead of $0
|
||||
default_postinst "${BUNDLED_PACKAGE_NAME_2}" $@
|
||||
for package in "${BUNDLED_PACKAGES[@]}"; do
|
||||
handle_bundled_postinst "$package"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user