ADCH++ Thread

Discussion and questions about hub software
Toast

Re: ADCH++

Post by Toast » 26 Feb 2009, 08:35

Thank you :) nice to have someone to test with now to start messing with python and making a start up script :)

Toast

Re: ADCH++

Post by Toast » 26 Feb 2009, 09:03

Code: Select all

#!/bin/bash
# adchppd install script version 1.0 
# This file is made for ADCH++ (http://adchpp.sf.net/)
# Install script made by Toast (http://www.adcportal.com)
# This will start retrieving tools necessary for getting the source
# Before running this script make sure to edit your adchpp.xml to your needs its located in adchpp/etc/
echo installation starting...
echo retriving Launchpad Bazaar Tool and Python
sudo apt-get install bzr python
bzr branch lp:adchpp
cd adchpp
echo "This will compile the source, getting nessary compilers for making ADCH++"
sudo apt-get install gcc scons swig
echo Edit the line to scons to "scons mode=release" if you want a release build instead of debug build
scons
echo now the script will start to copy the files to its correct place
sudo cp -rf etc build/debug-default/bin/etc
sudo cp -rf plugins/Script/examples build/debug-default/bin/Scripts
sudo apt-get install lua5.1 liblua5.1-0
sudo mkdir -p /usr/local/lib/lua/5.1
sudo cp build/debug-default/bin/luadchpp.so /usr/local/lib/lua/5.1/
export LUA_PATH='/home/toast/adchpp/build/debug-default/bin/Scripts/?.lua'
echo "Install script done"
im thinking of rewriting the script so it puts everything in its default place like usr/bin/adchpp for the app and config in etc/adchpp that would be more easier for newbies to work with

having some troubles retrieving the source with the script thou :( so if anyone has good ideas about how to fix it please helpout and the lua path is not set correctly yet im not done putting everything to place

Toast

Re: ADCH++

Post by Toast » 26 Feb 2009, 12:42

Code: Select all

#!/bin/bash
# adchppd install script version 1.0 
# This file is made for ADCH++ (http://adchpp.sf.net/)
# Install script made by Toast (http://www.adcportal.com)
# This will start retrieving tools necessary for getting the source
# Before running this script make sure to edit your adchpp.xml to your needs its located in adchpp/etc/
# Usage: sh adchpp_install_script.sh
echo installation starting...
echo retriving Launchpad Bazaar Tool and Python
sudo apt-get install bzr python
bzr branch lp:adchpp
cd adchpp
echo "This will compile the source, getting nessary compilers for making ADCH++"
sudo apt-get install gcc scons swig
echo Edit the line to scons to "scons mode=release" if you want a release build instead of debug build
scons
echo now the script will start to copy the files to its correct place
sudo cp -rf /build/debug-default/bin /usr/bin/adchpp
sudo cp -rf etc /etc/adchpp
sudo apt-get install lua5.1 liblua5.1-0
sudo mkdir -p /usr/local/lib/lua/5.1/
sudo mkdir -p /usr/local/share/lua/5.1/
sudo cp -rf plugins/Script/examples /usr/local/share/lua/5.1/
sudo cp /usr/bin/adchpp/luadchpp.so /usr/local/lib/lua/5.1/
export LUA_PATH='/usr/local/share/lua/5.1/?.lua'
echo "Install script done"
but im still having troubles with getting the source from launchpad via bzr it just skips that part so im wondering how to go about fixxing that perhaps wait or if parameters or something kinda stuck here..

yapi
Newbie
Posts: 8
Joined: 25 Feb 2009, 15:24

Re: ADCH++

Post by yapi » 26 Feb 2009, 14:15

Toast wrote:Thank you :) nice to have someone to test with now to start messing with python and making a start up script :)
no problem ;) i'm glad i can help :) u r doing a great job with install script! Soon we'll have totally automated install and run scripts and maybe pack it ?

here's cron script to check if adchpp is running (it's based on anope check script):

adchpp.chk

Code: Select all

#!/bin/sh

# Crontab script for ADCH++
#
# To know how to install the crontab, read the INSTALL file.

###############################################################
# CONFIGURATION
###############################################################

# ADCH++ binary directory
ADCPATH=/home/yapi/adchpp/build/debug-default/bin

# Name of the pid file
ADCPIDF=adchpp.pid

# Name of the executable
ADCPROG=adchppd

# Parameters to pass to the executable
ADCARGS="-d -p"

###############################################################
#                 DON'T EDIT ANYTHING BELOW                   #
###############################################################

PATH=/bin:/usr/bin:/usr/local/bin

ADCPID=

cd $ADCPATH

if [ -f $ADCPIDF ]
then
        ADCPID=`cat $ADCPIDF`
        if [ `ps auwx | grep $ADCPROG | grep $ADCPID | grep -v -c grep` = 1 ]
        then
                exit
        fi
        rm -f $ADCPIDF
fi

./$ADCPROG $ADCARGS $ADCPIDF
i'll make a startup script later today (for /etc/init.d/ ), and I was thinkig adding sys user to run adchpp so it would prevent possible xploitz and help us maintain hierarchy such as home dir for executable... What do u think?

Toast

Re: ADCH++

Post by Toast » 26 Feb 2009, 19:29

Code: Select all

#!/bin/bash
#
# adchppd startup script version 1.0 
# 
# This file is made for ADCH++ (http://adchpp.sf.net/)

# Specify config for adchppd.
. /etc/adchpp
# This part checks if network is up if its not it stops the startup script
# note: this might not work on every distribution so rem this comment if it causes problems
[[ ${NETWORKING} = "no" ]] && exit 0

stop (){
#This will kill any running adchppd so we dont get any erorrs.
echo "Checking so there isnt any current running adchppd processes."
for oldpid in `ps -A | grep adchppd | cut -c 0-6`; do
kill -9 $oldpid
if [[ $1 == "-v" ]]
then
echo $oldpid
fi
done
rm -f /var/run/adchppd.pid
}

start (){
#This will start the process.
if [[ $1 == "-v" ]]
then
echo "Starting adchppd process"
fi

servcount=`expr 0`
for cfile in `ls /etc/adchpp`; do
echo -n $cfile
echo -n " -> "
grep adchppd /etc/adchpp/$cfile
# This line will execute adchppd
#sudo -u nobody /usr/bin/adchppd /etc/adchpp/$cfile > /dev/null &
/usr/bin/adchppd /etc/adchpp/$cfile > /dev/null &
let servcount=servcount+1
done

#Create the pid file...
ps -A | grep adchppd | cut -c 0-6 > /var/run/adchppd.pid
#Creating pid file is done!
echo "adchppd is running now."
}

case "$1" in
start)
if [[ ! -e /var/run/adchppd.pid ]]
then
start $2

if [[ -e /var/run/adchppd.pid ]]
then
echo "Startup [SUCCESS]"
fi

else
if [[ $2 == "-v" ]]
then
echo "adchppd is already running checking pids..:"
#Checks before displaying pid file.
if [[ -e /var/run/adchppd.pid ]]
then
cat /var/run/adchppd.pid
fi
echo "Please kill any old adchppd processes."
else
echo "adchppd is already running please kill any old processes."
fi
echo "Startup [FAILED]"
fi
;;
restart)
stop $2
if [[ $2 == "-v" ]]
then
echo "Waiting for old adchppd processes to die.."
fi

sleep 4
start $2
if [[ -e /var/run/adchppd.pid ]]
then
echo "Startup [SUCCESS]"
fi
;;
stop)
if [[ -e /var/run/adchppd.pid ]];
then
stop $2
echo "adchppd shutdown [SUCCESS]"
else
echo "Couldnt find any adchppd processes trying to kill anyways.."
stop $2
fi
;;
*)
echo "Usage: adchppd (start|stop|restart) [-v]"
please check if it works okey

Toast

Re: ADCH++

Post by Toast » 26 Feb 2009, 21:28

Code: Select all

#!/bin/bash
# adchppd install script version 1.0a
# This file is made for ADCH++ (http://adchpp.sf.net/)
# Install script made by Toast (http://www.adcportal.com)
# This will start retrieving tools necessary for getting the source
# Before running this script make sure to edit your adchpp.xml to your needs its located in adchpp/etc/
# Usage: sh adchpp_install_script.sh
if [ `id -u` = 0 ]; then
echo installation starting...
echo retriving Launchpad Bazaar Tool and Python
apt-get install bzr python
bzr branch lp:adchpp
cd adchpp
echo "This will compile the source, getting nessary compilers for making ADCH++"
apt-get install gcc scons swig
echo Edit the line to scons to "scons mode=release" if you want a release build instead of debug build
scons
echo now the script will start to copy the files to its correct place
cp -rf /build/debug-default/bin/ /usr/bin/adchpp/
cp -rf etc /etc/adchpp
apt-get install lua5.1 liblua5.1-0
mkdir -p /usr/local/lib/lua/5.1/
mkdir -p /usr/local/share/lua/5.1/
cp -rf plugins/Script/examples /usr/local/share/lua/5.1/
cp /usr/bin/adchpp/luadchpp.so /usr/local/lib/lua/5.1/
export LUA_PATH='/usr/local/share/lua/5.1/?.lua'
echo "Install script done"
else
	echo please run as root
fi
still got that bzr problem :( but mikejj helped me make it so that all sudo commands are gone and the scripts runs in as rootuser

MikeJJ
Newbie
Posts: 9
Joined: 22 Jun 2008, 12:05

Re: ADCH++

Post by MikeJJ » 27 Feb 2009, 01:08

Code: Select all

#!/bin/bash
# adchppd install script version 1.0
# This file is made for ADCH++ (http://adchpp.sf.net/)
# Install script made by Toast (http://www.adcportal.com)
# This will start retrieving tools necessary for getting the source
# Before running this script make sure to edit your adchpp.xml to your needs its located in adchpp/etc/
# Usage: sh adchpp_install_script.sh

if [ `id -u` != 0 ]; then
	echo please run as root
	exit
fi

echo installation starting...
echo retriving Launchpad Bazaar Tool and Python
apt-get install bzr python
bzr branch lp:adchpp
cd adchpp
echo "This will compile the source, getting nessary compilers for making ADCH++"
apt-get install gcc scons swig
echo Edit the line to scons to "scons mode=release" if you want a release build instead of debug build
scons
echo now the script will start to copy the files to its correct place
cp -rf /build/debug-default/bin/ /usr/bin/adchpp/
cp -rf etc /etc/adchpp
apt-get install lua5.1 liblua5.1-0
mkdir -p /usr/local/lib/lua/5.1/
mkdir -p /usr/local/share/lua/5.1/
cp -rf plugins/Script/examples /usr/local/share/lua/5.1/
cp /usr/bin/adchpp/luadchpp.so /usr/local/lib/lua/5.1/
export LUA_PATH='/usr/local/share/lua/5.1/?.lua'
echo "Install script done"
Made the if nicer. Maybe fix the error you sent me in pm ? :)

P.S. Is this needed ? The inclusion of this is why i don't really wanna run it.

Code: Select all

mkdir -p /usr/local/lib/lua/5.1/
mkdir -p /usr/local/share/lua/5.1/
cp -rf plugins/Script/examples /usr/local/share/lua/5.1/
cp /usr/bin/adchpp/luadchpp.so /usr/local/lib/lua/5.1/

Toast

Re: ADCH++

Post by Toast » 27 Feb 2009, 08:54

tnx mikejj kinda beginner at bash so any help i can get is just fine :)

yapi
Newbie
Posts: 8
Joined: 25 Feb 2009, 15:24

Re: ADCH++

Post by yapi » 27 Feb 2009, 09:26

@MikeJJ

well there are compile instructions in source but not install ones. you can compile the source but it just wont work because scons doesn't copy files where they supposed to be :(

@Toast
great work :) i was thinking to write a init.d script with LSB support http://wiki.debian.org/LSBInitScripts but your's good. maybe you should only add LSB part?

Toast

Re: ADCH++

Post by Toast » 27 Feb 2009, 11:05

not that good sry but we can perhaps co-lab :)

Locked