Skip to content

Step 2: create the "remove" script

iVAN edited this page Mar 16, 2022 · 1 revision

This part is the most important because we must be ready to remove everything that will be installed or, in case of errors, not installed, with or without "AM". The remove script must contain the exact location of everything this script will generate, this way:

echo '#!/bin/sh' >> /opt/$APP/remove
echo "rm -R -f /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove

In this script above we have a launcher AM-$APP.desktop in /usr/share/applications (since the 2.5.0 release, the name of each launcher will start with "AM-" to prevent conflicts with programs installed in parallel from other sources), a link $APP in /usr/local/bin and obviusly the directory $APP we have created in /opt (see STEP 1). Make the remove script executable:

chmod a+x /opt/$APP/remove

From now, in case you wanto to uninstall the program or solve a broken installation with your script, it is possible to execute the remove script with the am -r $YOUR-APP or the sudo /opt/$YOUR-APP/remove commands.