mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Combined module management actions into a single file, so it should be easier to add new optional modules.
This commit is contained in:
1 parent
411785eb3f
commit
c9d58ee73d
6 files changed
+69
-50
No files matched your search
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: module-disable python_root module
|
||||
# This will change when we switch to using aptitude.
|
||||
|
||||
# TODO: Replace this with "aptitude purge plinth-<module>"
|
||||
case "$2" in
|
||||
owncloud)
|
||||
if [ -e "$1"/modules/owncloud.py ] ; then
|
||||
rm -f "$1"/modules/owncloud.py
|
||||
echo "disabled owncloud"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: module-enable python_root module
|
||||
# This will change when we switch to using aptitude.
|
||||
|
||||
# TODO: Replace this with "aptitude install plinth-<module>"
|
||||
case "$2" in
|
||||
owncloud)
|
||||
if [ ! -e "$1"/modules/owncloud.py ] ; then
|
||||
ln -s "$1"/modules/installed/apps/owncloud.py "$1"/modules/owncloud.py
|
||||
echo "enabled owncloud"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: module-list-available
|
||||
# This will change when we switch to using aptitude.
|
||||
|
||||
# TODO: Replace this with something like "aptitude search -F %p plinth-"
|
||||
echo "owncloud"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Usage: module-list-enabled python_root
|
||||
# This will change when we switch to using aptitude.
|
||||
|
||||
# TODO: Replace this with something like 'aptitude search -F %p | grep "plinth-"'
|
||||
if [ -e "$1"/modules/owncloud.py ] ; then
|
||||
echo "owncloud"
|
||||
fi
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage:
|
||||
# module-manager list-available
|
||||
# module-manager list-enabled <python_root>
|
||||
# module-manager enable <python_root> <module_name>
|
||||
# module-manager disable <python_root> <module_name>
|
||||
|
||||
# associate array with mapping between module names and install paths
|
||||
# (relative to <python_root>/modules/)
|
||||
declare -A modules=( ["owncloud"]="installed/apps/owncloud.py" )
|
||||
|
||||
case "$1" in
|
||||
"list-available")
|
||||
# TODO: Replace this with something like "aptitude search -F %p plinth-"
|
||||
echo "${!modules[@]}"
|
||||
;;
|
||||
|
||||
"list-enabled")
|
||||
# TODO: Replace this with something like 'aptitude search -F %p | grep "plinth-"'
|
||||
for module in "${!modules[@]}"
|
||||
do
|
||||
if [ -e "$2"/modules/"$module".py ] ; then
|
||||
echo "$module"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
"enable")
|
||||
# TODO: Replace this with "aptitude install plinth-<module>"
|
||||
for module in "${!modules[@]}"
|
||||
do
|
||||
if [ "$3" == "$module" ] ; then
|
||||
if [ ! -e "$2"/modules/"$3".py ] ; then
|
||||
ln -s "$2"/modules/"${modules["$3"]}" "$2"/modules/"$3".py
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && echo "enabled" "$3"
|
||||
[ $RETVAL -ne 0 ] && echo "failed to enable" "$3"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
"disable")
|
||||
# TODO: Replace this with "aptitude purge plinth-<module>"
|
||||
for module in "${!modules[@]}"
|
||||
do
|
||||
if [ "$3" == "$module" ] ; then
|
||||
if [ -e "$2"/modules/"$3".py ] ; then
|
||||
rm -f "$2"/modules/"$3".py
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && echo "disabled" "$3"
|
||||
[ $RETVAL -ne 0 ] && echo "failed to disable" "$3"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user