Another install script

Download PHCTool releases
Post Reply
loomsen
Posts: 5
Joined: Mon 20. Jul 2009, 01:15

Another install script

Post by loomsen » Tue 21. Jul 2009, 02:33

Hello.

I took a closer look at the files included and had to rewrite it. The shell scripts were pretty ugly, basically only needed because of the relative paths used all over the scripts. Using gksu instead of sudo doesn't make much of a sense neither, for instance I use beesu instead of gksu (there is no gksu pkg in fedora, at least not in the main repo). Further, sudo is intended to be used in shells only, while gksu/beesu should be used with graphical interfaces.
I decided to remove all 3 "wrapper" files and write a whole new script.
However, I wrote some couple of lines to it which would add a group like the original script did. Need to uncomment them, I've written where inside the script.

Code: Select all

#!/bin/bash
# 
# written by
# Norbert Varzariu <loomsen@googlemail.com>	
###
# installer script for the phctools
###
_DESTDIR=/opt/phc
#_GRPNAME="phcusers"  # HINT ======== uncomment for a group


# test permissions
[ "$UID" != "0" ] && echo "You don't have sufficient privileges to run this script." && exit "$?"

# HINT === Uncomment the next line if you want to add a system group, i.e. for holding permissions or so
# groupadd -r $_GRPNAME

# move files to DESTDIR and make them executable
[ "$PWD" == "$_DESTDIR" ] && chmod 775 {phctool,phctray}.py || \
		mkdir -p $_DESTDIR && cp -r $PWD/* $_DESTDIR/ && chmod 775 $_DESTDIR/{phctool,phctray}.py
# change owner
# HINT ==== another uncomment below if you prefer to go with a group - comment out the line above then...
chown -R root:root "$_DESTDIR"
#chown -R root:"$_GRPNAME" "$_DESTDIR"

## remind user of group ======== If you go with the group, uncomment below for a reminder
#echo "In order to use phctray and phctool please add yourself to the '$_GRPNAME' group and log out of your current session"
unset _DESTDIR # _GRPNAME
exit "$?"

the-fallen
Administrator
Posts: 346
Joined: Wed 9. Jul 2008, 19:57

Re: Another install script

Post by the-fallen » Tue 21. Jul 2009, 16:59

Thanks for your work.

I have to agree that the code is not good. At the time I wrote it I did not know it better.

PHCTool2 in combination with the phc-initd start script PHCTool does not need to be root anymore so it can not be used to cut security holes into the system.


If you like to I would be happy if you help with PHCTool2 so it can finally be released. The latest state of developement is not public but I can send it to anyone interested in developing / completing the plugins.

loomsen
Posts: 5
Joined: Mon 20. Jul 2009, 01:15

Re: Another install script

Post by loomsen » Sat 1. Aug 2009, 09:47

Sure, send me... I'll look into it when I find the time.

loomsen <at> googlemail.com

Post Reply