-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api update (install_packages and failed installs) #1323
Conversation
removed unnecessary functionality that results in the dummy deb for an app being removed if install_packages fails removing this functionality allow for install_packages to be used within a script in a non-fatal manner, where previous install_packages dependencies are saved
to add to this, I've noticed at least one other script is already expecting this non-fatal |
manage
Outdated
#remove dummy deb if app failed to install (to avoid dummy debs being left on a users install for broken apps) | ||
if [[ ${mode} == "install" ]] && [[ "$(app_type "$app")" == standard ]]; then | ||
local package_name="$(app_to_pkgname "$app")" | ||
local output="$(sudo -E apt purge -y $package_name 2>&1 | less_apt | tee /dev/stderr)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why run apt purge
rather than purge_packages
? Also this may run unnecessarily if the dummy deb is not installed, so a check needs to be added to address that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an unnecessary run isn't a big deal, but yeah that can be checked
I ran apt purge because that is what you ran in your script. It mimics the previous functionality by moving it to the manage script only when the app fails while not having the drawbacks of purging the dummy deb unnecessarily during a non-fatal install_packages run
#If this app's dummy deb is already insalled, uninstall it
if package_installed "$package_name" ;then
status "Reinstalling the $package_name package..."
apt_lock_wait
local output="$(sudo -E apt purge -y $package_name 2>&1 | less_apt | tee /dev/stderr)"
if [ $? != 0 ];then
echo "$output"
error "Failed to purge dummy deb ($package_name)"
fi
else
status "Installing the $package_name package..."
fi
the main difference between running what I have written now and doing purge_packages is purge_packages will do an apt autoremove.
I think an autoremove is fine for a failed first time install but I don't think its a good idea for a failed update.
also @Botspot I just noticed this:
is this a bug? I thought the only app_type was "standard" and "package". no such thing as "app" and that will prevent the app status from getting set as corrupted
|
looks like you introduced the bug 2 weeks ago in this commit eea069e |
Wow you're right. |
…oval if part of an update also check if dummy deb is installed before purging remove local definitions as this is not a function and unset variables since they should not be set
these changes now allow for script writers to implement
install_packages
in their script and allow for it to fail non-fatally and keep the previous Depends: packagesfor example: its nice to have adoptopenjdk-16 but not necessary for MultiMC to work, so install_packages for this specific package is made non-fatal, but without the changes here, ALL other previously installed dependencies are removed from the dummy deb since it is purged
for scripts where failing
install_packages
is a fatal error, there is no change as the dummy deb gets purged by the manage script now.