I can activate all of my office modules with one simple command:
Code: Select all
act office
With this script i just need to open a terminal and enter
Code: Select all
act filezill
USAGE:
--------------------
act filezilla
SETUP:
--------------------
Copy the script into a file and save the file to your /usr/bin/ directory (call it act)
Make the script executable: chmod +x /usr/bin/act
Now it is ready to use.
EDITS:
--------------------
If you don't use the optional folder to store your modules then edit the path to your modules in the script. It is well commented so you shouldn't have any problem finding the place to edit.
Code: Select all
#!/bin/bash
# Script by jayflood
# Script to activate modules in the slax optional folder and sub folders.
# You can prepend all your OFFICE apps with 'office' (e.g office-gcalc.lzm)
# and activate them with <script> <office>
# or you can put all your office apps in a folder called 'office'
# and they will all be activated with <script> <office>
script=${0##*/}
USER=`whoami`
CONFIG="/$USER/.kde/share/config/slxscriptsrc"
CONFPATH="/$USER/.kde/share/config"
usage()
{
cat <<EOF
-------------
USAGE:
$script <module>
$script <folder>
$script remove
-------------
If the module exists in specified directory then module
will be activated.
If the folder exists in specified path then all modules
within folder will be activated.
If the 'remove' switch is used your config file is deleted
The script uses a wildcard.
$script bluetoo = $script bluetooth
In this case any folder called bluetooth will have modules
inside activated, or modules called bluetooth.lzm found
anywhere within the specified folder (or sub folders) will
be activated.
EOF
}
# if nothing is entered after script then show usage
if [ $# -eq 0 ]; then
usage
exit 1
fi
if [ -f $CONFIG -a $1 == "remove" ]; then
rm -f $CONFIG
echo "$CONFIG file has been removed"
exit 1
fi
# Check if config file exists
if [ -f $CONFIG ]; then
MODULES=$(grep -A1 "[modfolder]" $CONFIG | tail -1)
else
touch $CONFIG
echo "[modfolder]" > $CONFIG
echo
echo ---------------------------------------
echo "Please enter the full path to the folder"
echo "where your optional modules are stored."
echo "For example: /mnt/hda1/slax/optional"
echo
echo "You will only need to enter this this once "
echo "and a config file will be created. To remove"
echo "The config file use: $script remove"
read optf
echo "$optf" >> $CONFIG
MODULES=$(grep -A1 '[modfolder]' $CONFIG | tail -1)
fi
# If the input matches a directory then activate all within
if [ -d $MODULES/$1* ]; then
for fold in $( find $MODULES/$1* -name "*.lzm");
do activate $fold;
NUM=$( find $MODULES/$1* -name "*.lzm" | wc -l)
done
echo
echo "$NUM modules were activated"
exit
fi
# If the input matches a module then activate
if [ -f $MODULES/$1*.lzm ]; then
for mod in $( find $MODULES -name $1*.lzm);
do activate $mod;
done
exit
fi
# If this point is reached then the input entered did not match
# a module or a folder and the script will exit gracefully.
echo
echo "Nothing matching your input ($1) was found !!"
echo
exit