SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "ppp"

# SliTaz package receipt.

PACKAGE="ppp"
VERSION="2.4.9"
CATEGORY="network"
SHORT_DESC="Implements the Point-to-Point Protocol (PPP)."
MAINTAINER="pankso@slitaz.org"
LICENSE="BSD GPL"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://ppp.samba.org/"
WGET_URL="https://github.com/paulusmack/ppp/archive/$TARBALL"
CONFIG_FILES="/etc/ppp/options"
SECRET_FILES="/etc/ppp/*secrets"
HOST_ARCH="i486 arm"

DEPENDS="libpcap libssl"
BUILD_DEPENDS="wget openssl-dev libpcap-dev"
SUGGESTED="tazpanel"

current_version()
{
    wget -O - ${WGET_URL%/arch*}/tags 2>/dev/null | \
    sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q'
}

# Rules to configure and make the package.
compile_rules()
{
    case "$ARCH" in
    arm*)
        export PATH=/cross/arm/tools/arm-slitaz-linux-gnueabi/bin:$PATH
    esac

    # Patch to use with glibc < 2.24
    # see https://github.com/ppp-project/ppp/commit/98ec18f
    patch -p1 < $stuff/ppp-glibc.patch

    ./configure --prefix=/usr \
        $CONFIGURE_ARGS &&
    make &&
    make DESTDIR=$DESTDIR/usr install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr/share/applications \
         $fs/var/www/tazpanel/menu.d/network/VPN
    cp -a $install/usr/sbin $fs/usr
    [ -d "$install/usr/lib" ] && cp -a $install/usr/lib $fs/usr
    cp -a $stuff/ppp.cgi $fs/var/www/tazpanel
    cp $stuff/*.desktop $fs/usr/share/applications
    ln -s ../../ppp.cgi $fs/var/www/tazpanel/menu.d/network/ppp
    ln -s ../../../ppp.cgi $fs/var/www/tazpanel/menu.d/network/VPN/ppp
    
    # Config files.
    mkdir -p $fs/etc/ppp/scripts $fs/etc/ppp/ip-up.d $fs/etc/ppp/ip-down.d
    cp $stuff/README.scripts $fs/etc/ppp
    cp -a $src/etc.ppp/* $fs/etc/ppp

    # PPP scripts.
    cp -a $src/scripts/ppp-on $fs/etc/ppp/scripts
    cp -a $src/scripts/ppp-on-dialer $fs/etc/ppp/scripts
    sed -i 's:ppp/ppp-on-dialer:ppp/scripts/ppp-on-dialer:' \
        $fs/etc/ppp/scripts/ppp-on
    
    cp -a $src/scripts/ppp-off $fs/etc/ppp/scripts
    cp -a $src/scripts/callback $fs/etc/ppp/scripts
    cp -a $src/scripts/redialer $fs/etc/ppp/scripts
    cat >> $fs/etc/ppp/ip-up <<EOT
if [ -x /etc/ppp/ip-up.d/\$6 ]; then
    . /etc/ppp/ip-up.d/\$6 "\$@"
elif [ -n "\$DNS1\$DNS2" ]; then
    rm -f /etc/ppp/resolv.prev
    [ -s /etc/resolv.conf ] && mv -f /etc/resolv.conf /etc/ppp/resolv.prev
    [ -n "\$DNS1" ] && echo "nameserver \$DNS1" >> /etc/resolv.conf
    [ -n "\$DNS2" ] && echo "nameserver \$DNS2" >> /etc/resolv.conf
    chmod 644 /etc/resolv.conf
fi
EOT
    cat >> $fs/etc/ppp/ip-down <<EOT
if [ -x /etc/ppp/ip-down.d/\$6 ]; then
    . /etc/ppp/ip-down.d/\$6 "\$@"
elif [ -n "\$DNS1\$DNS2" ]; then
    rm -f /etc/resolv.conf
    mv -f /etc/ppp/resolv.prev /etc/resolv.conf
fi
EOT
    # cp -a $src/scripts/ip-up.local.add $fs/etc/ppp/ip-up
    # cp -a $src/scripts/ip-down.local.add $fs/etc/ppp/ip-down
    chmod 711 $fs/etc/ppp/ip-up $fs/etc/ppp/ip-down

    # insert #!/bin/sh  on top line in ip* scripts
    sed -i '1i\#!/bin/sh' $fs/etc/ppp/ip* 2>/dev/null    
    # add empty peers dir
    mkdir -p $fs/etc/ppp/peers
    # hide login/pass from regular users
    chmod go-rwx $fs/etc/ppp/*secrets
    chmod go-rwx $fs/etc/ppp/options
    chmod 711 $fs/etc/ppp/scripts/*
}

post_install()
{
    rm -f $1/var/cache/tazpanel/header.* 2>/dev/null || true
    chroot "$1/" chgrp dialout /usr/sbin/pppd
    chmod 4750 $1/usr/sbin/pppd
    echo
    echo " ADD yourself to group dialout to use pppd: addgroup tux dialout"
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)