Clean up all "Not Installed (Locally available)"

Used with FreePBX 17. Can be adapted for 16 I think.

I coded a script to remove (clean up) all “Not Installed (Locally available)”.

1- Create a file rm-uninstalled-modules into /usr/local/bin/
2- edit this file and put this code here.


#!/usr/bin/bash

modules=$(fwconsole ma list | grep "Not Installed (Locally available)")

if [ -z "$modules" ]; then
  echo "No uninstalled module locally found to remove."
  exit 0
fi

echo "Modules to remove:"
echo "$modules" | while read -r line; do
  module_name=$(echo $line | awk -F'|' '{print $2}' | xargs)

  if [ -n "$module_name" ]; then
    echo "Removing module: $module_name"
    fwconsole ma remove "$module_name"
  fi
done

fwconsole r
clear
fwconsle ma list

3- Execute: chmod +x /usr/local/bin/rm-uninstalled-modules

Now, you can launch rm-uninstalled-modules on your console and get this result:

+-------------------+------------+---------+------------+-----------+
| Module            | Version    | Status  | License    | Signature |
+-------------------+------------+---------+------------+-----------+
| amd               | 17.0.1     | Enabled | GPLv3+     | Sangoma   |
| announcement      | 17.0.2.1   | Enabled | GPLv3+     | Sangoma   |
| api               | 17.0.1.6   | Enabled | AGPLv3+    | Sangoma   |
| arimanager        | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| asterisk-cli      | 17.0.2     | Enabled | GPLv3+     | Sangoma   |
| asteriskinfo      | 17.0.2     | Enabled | GPLv3+     | Sangoma   |
| backup            | 17.0.5.61  | Enabled | GPLv3+     | Sangoma   |
| blacklist         | 17.0.1.2   | Enabled | GPLv3+     | Sangoma   |
| builtin           |            | Enabled |            | Unsigned  |
| bulkhandler       | 17.0.5     | Enabled | GPLv3+     | Sangoma   |
| calendar          | 17.0.4.20  | Enabled | GPLv3+     | Sangoma   |
| callback          | 17.0.2.1   | Enabled | GPLv3+     | Sangoma   |
| callforward       | 17.0.1.6   | Enabled | AGPLv3+    | Sangoma   |
| callrecording     | 17.0.3.8   | Enabled | AGPLv3+    | Sangoma   |
| callwaiting       | 17.0.3.4   | Enabled | GPLv3+     | Sangoma   |
| cdr               | 17.0.4.22  | Enabled | GPLv3+     | Sangoma   |
| cel               | 17.0.2.10  | Enabled | GPLv3+     | Sangoma   |
| certman           | 17.0.3.13  | Enabled | AGPLv3+    | Sangoma   |
| cidlookup         | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| conferences       | 17.0.3.2   | Enabled | GPLv3+     | Sangoma   |
| configedit        | 17.0.1.4   | Enabled | AGPLv3+    | Sangoma   |
| contactmanager    | 17.0.5.12  | Enabled | GPLv3+     | Sangoma   |
| core              | 17.0.18.1  | Enabled | GPLv3+     | Sangoma   |
| customappsreg     | 17.0.1     | Enabled | GPLv3+     | Sangoma   |
| dashboard         | 17.0.4.6   | Enabled | AGPLv3+    | Sangoma   |
| daynight          | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| dictate           | 17.0.1.2   | Enabled | GPLv3+     | Sangoma   |
| directory         | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| donotdisturb      | 17.0.2.3   | Enabled | GPLv3+     | Sangoma   |
| dynroute          | 17.0.3.2   | Enabled | GPLv3+     | Sangoma   |
| extensionsettings | 17.0.1     | Enabled | GPLv3+     | Sangoma   |
| fax               | 17.0.3.4   | Enabled | GPLv3+     | Sangoma   |
| featurecodeadmin  | 17.0.2     | Enabled | GPLv3+     | Sangoma   |
| filestore         | 17.0.2.31  | Enabled | AGPLv3     | Sangoma   |
| findmefollow      | 17.0.4.10  | Enabled | GPLv3+     | Sangoma   |
| firewall          | 17.0.1.26  | Enabled | AGPLv3+    | Sangoma   |
| framework         | 17.0.19.13 | Enabled | GPLv2+     | Sangoma   |
| hotelwakeup       | 17.0.1.6   | Enabled | GPLv2      | Sangoma   |
| infoservices      | 17.0.1.1   | Enabled | GPLv2+     | Sangoma   |
| ivr               | 17.0.8     | Enabled | GPLv3+     | Sangoma   |
| languages         | 17.0.1     | Enabled | GPLv3+     | Sangoma   |
| logfiles          | 17.0.3.3   | Enabled | GPLv3+     | Sangoma   |
| manager           | 17.0.6     | Enabled | GPLv2+     | Sangoma   |
| miscapps          | 17.0.3     | Enabled | GPLv3+     | Sangoma   |
| miscdests         | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| music             | 17.0.5     | Enabled | GPLv3+     | Sangoma   |
| paging            | 17.0.3     | Enabled | GPLv3+     | Sangoma   |
| parking           | 17.0.2.5   | Enabled | GPLv3+     | Sangoma   |
| phpinfo           | 17.0.1     | Enabled | GPLv2+     | Sangoma   |
| pinsets           | 17.0.3.2   | Enabled | GPLv3+     | Sangoma   |
| pm2               | 17.0.3.3   | Enabled | AGPLv3+    | Sangoma   |
| presencestate     | 17.0.2.4   | Enabled | GPLv3+     | Sangoma   |
| printextensions   | 17.0.1.2   | Enabled | GPLv3+     | Sangoma   |
| queueprio         | 17.0.1.4   | Enabled | GPLv3+     | Sangoma   |
| queues            | 17.0.1.12  | Enabled | GPLv2+     | Sangoma   |
| recordings        | 17.0.2.2   | Enabled | GPLv3+     | Sangoma   |
| ringgroups        | 17.0.2.6   | Enabled | GPLv3+     | Sangoma   |
| setcid            | 17.0.1.2   | Enabled | GPLv3+     | Sangoma   |
| sipsettings       | 17.0.6.9   | Enabled | AGPLv3+    | Sangoma   |
| soundlang         | 17.0.4.1   | Enabled | GPLv3+     | Sangoma   |
| sysadmin          | 17.0.1.97  | Enabled | Commercial | Sangoma   |
| timeconditions    | 17.0.1.18  | Enabled | GPLv3+     | Sangoma   |
| tts               | 17.0.1.1   | Enabled | GPLv3+     | Sangoma   |
| ttsengines        | 17.0.1     | Enabled | AGPLv3     | Sangoma   |
| ucp               | 17.0.4.23  | Enabled | AGPLv3+    | Sangoma   |
| userman           | 17.0.6.28  | Enabled | AGPLv3+    | Sangoma   |
| vmblast           | 17.0.2     | Enabled | GPLv3+     | Sangoma   |
| voicemail         | 17.0.5.22  | Enabled | GPLv3+     | Sangoma   |
| weakpasswords     | 17.0.1     | Enabled | GPLv3+     | Sangoma   |
| webrtc            | 17.0.2.2   | Enabled | GPLv3+     | Sangoma   |
+-------------------+------------+---------+------------+-----------+
3 Likes

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.