Add installation warning to preinst

sdxpinn-mount-fix
remove no longer needed ipk
This commit is contained in:
iamromulan
2024-10-05 20:23:22 -04:00
parent 5b89d9098c
commit b7b8bb2838
2 changed files with 16 additions and 1 deletions

View File

@@ -2,8 +2,9 @@
# Define the location of detected packages file
DETECTED_PACKAGES_FILE="/tmp/detected_packages.tmp"
LIST_FILE_DELETED=false
# Check if specific packages are installed and delete their list files
# Function to check if a specific package is installed and delete its list file
detect_and_remove_list_files() {
local package_name="$1"
local list_file="/usr/lib/opkg/info/${package_name}.list"
@@ -13,6 +14,7 @@ detect_and_remove_list_files() {
echo "$package_name is already installed. Deleting $list_file to avoid conflicts."
rm -f "$list_file"
echo "$package_name" >> "$DETECTED_PACKAGES_FILE"
LIST_FILE_DELETED=true
else
echo "$package_name is not installed."
fi
@@ -30,6 +32,19 @@ else
echo "No pre-existing bundled packages detected."
fi
# If any list files were deleted, show a warning message at the end of the script
if [ "$LIST_FILE_DELETED" = true ]; then
echo -e "\e[31m================================================\e[0m"
echo -e "\e[31mPre-bundled packages detected\e[0m"
echo -e "\e[32mAssociation between said packages and respective files has been removed\e[0m"
echo -e "\e[31m================================================\e[0m"
echo -e "\e[31mopkg will fail now\e[0m"
echo -e "\e[32mYou need to try installing this package again\e[0m"
echo -e "\e[32mThen it will work\e[0m"
echo -e "\e[31m================================================\e[0m"
echo -e "\e[32m================================================\e[0m"
fi
# Check if /etc is mounted
if grep -qs '/etc ' /proc/mounts; then
echo "Unmounting /etc..."