File: autobuild

package info (click to toggle)
rrlogind 1%3A2.35-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 336 kB
  • ctags: 247
  • sloc: ansic: 1,532; sh: 268; makefile: 95
file content (119 lines) | stat: -rwxr-xr-x 2,763 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
#
# This file attempts to detect the OS version that you are running and
# compile the needed binaries.

OS=`uname`
OS_VERSION=`uname -r`
SYS_TYPE=`uname -m`
RRLOGIN_VER=2.35
CHKCONFIG=`which chkconfig`
RRPID=`pidof rrlogind`

if [ -z "${OS_VERSION}" ]; then
	echo "Unable to detect OS type... you will have to do it by hand"
	exit
fi

if [ "$1" = "install" ]; then
	INSTALL_TYPE=install
fi

if [ "$1" = "clean" ]; then
  cd rrlogind-${RRLOGIN_VER}
  make clean
  cd ../rrconf
  make clean
  cd ..
  rm -f binaries/*
  rm -f helper/endian
  exit
fi

echo "Operating system: $OS"

if [ -z $SYS_TYPE ]; then
	echo "Unable to determine machine type"
	exit
fi

if [ ! -z "${RRPID}" ] && [ "${INSTALL_TYPE}" = "install" ]; then
	echo "rrlogind running on PID: ${RRPID}, stopping service."
	# A SIGKILL seems kinda harsh, but it will force rrlogind to stop without
	# logging this computer out.	
	kill -9 $RRPID
	rm -f /var/run/rrlogind.pid
	# If this is a Red Hat style system, kill the subsystem lock
	if [ -f /var/run/subsys/roadrunner ]; then
		rm -f /var/lock/subsys/roadrunner
	fi
fi		

# Build the helper application
cd helper
gcc endian.c -o endian
ENDIAN=`./endian`
cd ..
echo "Byte order appears to be ${ENDIAN}"

if [ "$ENDIAN" = "BIGENDIAN" ]; then
	echo "Building for RISC architecture ( ${SYS_TYPE} )"
	cp -f ./rrlogind-${RRLOGIN_VER}/Makefile.risc ./rrlogind-${RRLOGIN_VER}/Makefile
	cp -f ./rrconf/Makefile.risc ./rrconf/Makefile
else
	cp -f ./rrlogind-${RRLOGIN_VER}/Makefile.x86 ./rrlogind-${RRLOGIN_VER}/Makefile
	cp -f ./rrconf/Makefile.x86 ./rrconf/Makefile
fi

# Build the rrconf utility
cd rrconf
make $INSTALL_TYPE
if [ -f rrconf ]; then
	cp -f rrconf ../binaries
else
	echo "rrconf build appears to have failed!"
	exit
fi
cd ..

cd rrlogind-${RRLOGIN_VER}
make $INSTALL_TYPE
if [ -f rrlogind ]; then
	cp -f rrlogind ../binaries
else
	echo "rrlogind build appears to have failed!"
	exit;
fi


echo
if [ -z $INSTALL_TYPE ]; then
	echo "Build complete... binaries are located in the ./binaries directory"
	echo "you will now need to install them manually, or re-run this script"
	echo "with an 'install' parameter."
else
	echo "Build complete."
	if [ -z $CHKCONFIG ]; then
		echo "RedHat chkconfig not found, service file not installed"
		
	else
		if [ -d /etc/rc.d/init.d ]; then
			echo "RedHat style init system found, installing roadrunner service file."
			cp ../scripts/roadrunner /etc/rc.d/init.d/
			$CHKCONFIG --add roadrunner
			# If rrlogind was running, attempt to restart it	
			if [ ! -z "${RRPID}" ]; then
				/etc/rc.d/init.d/roadrunner start
			fi
		fi
	fi
	if [ ! -d /etc/roadrunner ]; then
		echo "Creating Road Runner configuration directory"
		mkdir -p /etc/roadrunner
		/sbin/rrconf
	fi
fi

cd ..
echo
echo "Done."