Pejman Moghadam / Slackware

Slackware 13.1 - epkg package manager (encap) - Install FreeRadius 2.1.9 as example

Public domain


Bookmarks

Homepage: http://www.encap.org/epkg/
Original download link


Installation

cd /usr/src/
wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/epkg-2.3.9.tar.gz"
tar zxf epkg-2.3.9.tar.gz
cd epkg-2.3.9
./configure --with-encap-target=/ 
make && make install

Add install user

groupadd install
useradd -g install -m -s /bin/bash install
passwd -l install
chown install:install /usr/src  /usr/local/encap
chown -R install:install /usr/local/encap

Example: FreeRADIUS installation using epkg/encap


Installation

cd /usr/src
wget -c "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.1.9.tar.gz"
tar zxf freeradius-server-2.1.9.tar.gz
cd freeradius-server-2.1.9
./configure && make
R=/usr/local/encap/freeradius-server-2.1.9 make install

FreeRADIUS startup script

mkdir -p /usr/local/encap/freeradius-server-2.1.9/etc/rc.d/
cat > /usr/local/encap/freeradius-server-2.1.9/etc/rc.d/rc.radiusd << EOF
#!/bin/sh
#
# /etc/rc.d/rc.radiusd
#
case "\$1" in
  'start')
    echo 'Starting radiusd ...'
    PID=\$(pgrep '^radiusd\$')
    if [ "\$PID" == "" ] ; then
       /usr/local/sbin/radiusd
    else
      echo "radiusd is already running (PID: \$PID) !!!"
    fi
    ;;
  'stop')
    echo 'Stopping radiusd ...'
    killall radiusd
    ;;
  'restart')
    echo 'Restarting radiusd ...'
    killall radiusd
    sleep 2
    /usr/local/sbin/radiusd
    ;;
  *)
    echo "Usage: \$0 [start|stop|restart]"
    ;;
esac
EOF

postinstall script

cat > /usr/local/encap/freeradius-server-2.1.9/postinstall << EOF
#!/bin/bash

LINE="if [ -x /etc/rc.d/rc.radiusd ]; then /etc/rc.d/rc.radiusd start; fi"
FILE="/etc/rc.d/rc.local"

if ! grep -q "/etc/rc.d/rc.radiusd" "\$FILE"; then
  echo "\$LINE" >> "\$FILE"
fi

ldconfig

EOF

preremove script

cat > /usr/local/encap/freeradius-server-2.1.9/preremove << EOF
#!/bin/bash
/etc/rc.d/rc.radiusd stop
sed -i -e 's,.*/etc/rc.d/rc.radiusd.*,,' -e '/^$/d' /etc/rc.d/rc.local
ldconfig
EOF

Make Package

chmod +x /usr/local/encap/freeradius-server-2.1.9/postinstall
chmod +x /usr/local/encap/freeradius-server-2.1.9/preremove
chmod +x /usr/local/encap/freeradius-server-2.1.9/etc/rc.d/rc.radiusd
cd /usr/local/encap
mkencap freeradius-server-2.1.9

Install package

epkg freeradius-server-2.1.9-encap-ix86-linux2.6.tar.gz

Remove package

epkg -r freeradius-server-2.1.9

BY: Pejman Moghadam
TAG: epkg, freeradius, radius, encap
DATE: 2011-05-10 11:59:47


Pejman Moghadam / Slackware [ TXT ]