LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-13-2009, 06:25 AM   #1
KaLPo
LQ Newbie
 
Registered: May 2009
Location: Edinburgh
Distribution: Arch / Ubuntu / Sci Linux
Posts: 13

Rep: Reputation: 0
Eclipse plugins installer


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?

Last edited by KaLPo; 05-13-2009 at 06:36 AM. Reason: I mixed threads, sorry
 
Old 05-13-2009, 11:36 AM   #2
thermite1033
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 1
A cp to <eclipse-dir>/dropins is enaugh, and add '-clean' to the eclipse.ini file. I can not think of any files that needs to be merged.

sidenote:

I recommend to install eclipse in /opt or in /usr/local instead of /etc.
 
Old 05-13-2009, 04:35 PM   #3
KaLPo
LQ Newbie
 
Registered: May 2009
Location: Edinburgh
Distribution: Arch / Ubuntu / Sci Linux
Posts: 13

Original Poster
Rep: Reputation: 0
I don't know the difference among /opt /usr/local and /etc. Sincerely, I use always /etc because the apache2 folder is there and as I thought in my starts that this was the folder for programs I got used to use it... Can you explain me what is de difference?

I have tried to use cp -r and it works fine, it overwrites the files with the same name but well, I don't really care about that now. I said merge because I need to put the same folders inside the same folders, so I thought the cp command would overwrite the entire folder without preserving the original content. I see I was wrong xDDDDD.

I will share the code when finish

Thank you!
 
Old 05-13-2009, 05:35 PM   #4
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
Have a look at this page about the FHS - this may help. The Filesystem Heirarchy Standard. I wouldn't go putting application into /etc.
 
Old 05-13-2009, 06:19 PM   #5
KaLPo
LQ Newbie
 
Registered: May 2009
Location: Edinburgh
Distribution: Arch / Ubuntu / Sci Linux
Posts: 13

Original Poster
Rep: Reputation: 0
That link is amazing bgeddy, Thanks a lot!!!! and I will definitively change /etc for /opt.
 
  


Reply

Tags
bash, eclipse


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Require Eclipse Plugins for UML md_imranullah Linux - Software 0 01-15-2008 05:21 AM
Eclipse plugins.... culin Linux - General 0 12-20-2007 03:07 AM
LXer: Gentleware Unveils New Apollo for Eclipse and openArchitectureWare Eclipse Dist LXer Syndicated Linux News 0 10-25-2007 09:30 PM
LXer: 5 Eclipse plugins for discovering bad code LXer Syndicated Linux News 0 01-23-2007 05:33 AM
LXer: Linux device dev tools become Eclipse plugins LXer Syndicated Linux News 0 12-04-2006 08:54 AM


All times are GMT -5. The time now is 11:11 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration