3 PERL_SCRIPT="claws-mail-kdeservicemenu.pl"
4 DESKTOP_TEMPLATE="claws-mail-attach-files.desktop.template"
5 DESKTOP="claws-mail-attach-files.desktop"
6 SERVICEMENU_DIR="share/apps/konqueror/servicemenus"
8 function check_environ {
9 echo "Checking for kde-config..."
10 if [ -z "$(type 'kde-config' 2> /dev/null)" ]; then
11 echo "kde-config not found, checking for \$KDEDIR to compensate..."
12 if [ ! -z $KDEDIR ]; then
13 export PATH=$PATH:$KDEDIR/bin
15 KDEDIR=$(kdialog --title "Where is KDE installed?" --getexistingdirectory / )
16 test -z $KDEDIR && exit 1
17 export PATH=$PATH:$KDEDIR/bin
23 function install_all {
24 echo "Generating $DESKTOP ..."
25 SED_PREFIX=${PREFIX//\//\\\/}
26 sed "s/SCRIPT_PATH/$SED_PREFIX\\/bin\\/$PERL_SCRIPT/" $DESKTOP_TEMPLATE > $DESKTOP
27 echo "Installing $PREFIX/$SERVICEMENU_DIR/$DESKTOP"
28 mv -f $DESKTOP $PREFIX/$SERVICEMENU_DIR/$DESKTOP
29 echo "Installing $PREFIX/bin/$PERL_SCRIPT"
30 cp -f $PERL_SCRIPT $PREFIX/bin/
31 echo "Setting permissions ..."
32 chmod 0644 $PREFIX/$SERVICEMENU_DIR/$DESKTOP
33 chmod 0755 $PREFIX/bin/$PERL_SCRIPT
34 echo "Finished installation."
35 kdialog --msgbox "Finished installation."
38 function uninstall_all {
39 echo "Removing $PREFIX/$SERVICEMENU_DIR/$DESKTOP"
40 rm $PREFIX/$SERVICEMENU_DIR/$DESKTOP
41 echo "Removing $PREFIX/bin/$PERL_SCRIPT"
42 rm $PREFIX/bin/$PERL_SCRIPT
43 echo "Finished uninstall."
44 kdialog --msgbox "Finished uninstall."
48 echo "Usage: $0 [--global|--local|--uninstall-global|--uninstall-local]"
50 echo " --global attempts a system-wide installation."
51 echo " --local attempts to install in your home directory."
52 echo " --uninstall-global attempts a system-wide uninstallation."
53 echo " --uninstall-local attempts to uninstall in your home directory."
59 then option="--$(kdialog --menu "Please select installation type" \
60 local "install for you only" \
61 global "install for all users" \
62 uninstall-local "uninstall for you only" \
63 uninstall-global "uninstall for all users" 2> /dev/null)"
70 PREFIX=$(kde-config --prefix)
71 echo "Installing in $PREFIX ..."
72 if [ "$(id -u)" != "0" ]; then
73 exec kdesu "$0 --global"
79 PREFIX=$(kde-config --localprefix)
80 echo "Installing in $PREFIX ..."
81 if [ ! -d $PREFIX/bin ]; then
84 if [ ! -d $PREFIX/$SERVICEMENU_DIR ]; then
85 mkdir $PREFIX/$SERVICEMENU_DIR
89 "--uninstall-global" )
91 PREFIX=$(kde-config --prefix)
92 echo "Uninstalling in $PREFIX ..."
93 if [ "$(id -u)" != "0" ]; then
94 exec kdesu "$0 --uninstall-global"
100 PREFIX=$(kde-config --localprefix)
101 echo "Uninstalling in $PREFIX ..."