Hello!!
I am trying to program a little eclipse installer. It is supposed to install eclipse in /etc/eclipse and change permissions, add into the menu a eclipse.desktop with an icon and all this stuff. This is the script I have.
Code:
#!/bin/bash
function UNINSTALL {
echo "Removing /etc/eclipse"
rm -R --interactive=never /etc/eclipse
groupdel eclipse
echo "Removing /usr/share/applications/eclipse.desktop"
rm --interactive=never /usr/share/applications/eclipse.desktop
echo "Removing /bin/eclipse"
rm --interactive=never /bin/eclipse
echo "Done !"
}
function INSTALL {
echo "Installing"
echo "Removing old data"
UNISTALL
tar -zxvf eclipse.tar.gz
mv eclipse /etc
groupadd eclipse
chgrp eclipse /etc/eclipse
chmod ug+rwx /etc/eclipse -R
usermod -a -G $USER kalpo
cp eclipse.png /etc/eclipse
cat > /usr/share/applications/eclipse.desktop << EOF
[Desktop Entry]
Name=Eclipse
Exec=eclipse
Icon=/etc/eclipse/eclipse.png
Terminal=false
Type=Application
Categories=GNOME;GTK;Development;
EOF
cat > /bin/eclipse << EOF
/etc/eclipse/eclipse
EOF
chgrp eclipse /bin/eclipse
chmod a+rwx /bin/eclipse
echo "Done!!"
}
args=("$@")
i=0
USER="kalpo"
userLetter="-u"
UnInstallLetter="-U"
while [ $i -lt $# ]; do
#echo ${args[${i}]}
str=${args[${i}]}
if [ $str = $userLetter ]; then
TEMP_USER=${args[${i}+1]}
if [ ${#TEMP_USER} -gt 0 ]; then
USER=$TEMP_USER
let i=i+1
echo "USER SET: '$USER'"
else
echo "BAD USER SETTING. USING DEFAULT: '$USER'"
fi
elif [ $str = $UnInstallLetter ]; then
echo "Uninstalling"
UNINSTALL
exit 0;
fi
let i=i+1
done
INSTALL
It works all right but I want to improve it using other script for installing plugins.
It just have to untar the plugins and merge the plugins files in the eclipse folder.
My problem is that I don't know how to merge files in bash...
Can anyone help me?