#!/bin/sh

. config/options $1

mkdir -p $INSTALL/etc/ppp
  cp $PKG_BUILD/etc.ppp/chap-secrets $INSTALL/etc/ppp/chap-secrets.sample
  cp $PKG_BUILD/etc.ppp/pap-secrets $INSTALL/etc/ppp/pap-secrets.sample

# /etc/ppp/chap-secrets and /etc/ppp/pap-secets must be writeable
  ln -sf /var/cache/chap-secrets $INSTALL/etc/ppp/chap-secrets
  ln -sf /var/cache/pap-secrets  $INSTALL/etc/ppp/pap-secrets

mkdir -p $INSTALL/etc/ppp/peers
  cp $PKG_DIR/config/adsl.sample $INSTALL/etc/ppp/peers/

# /etc/ppp/peers/adsl must be writeable
  ln -sf /var/cache/adsl  $INSTALL/etc/ppp/peers/adsl

mkdir -p $INSTALL/etc/ppp/plugins
  cp $PKG_BUILD/pppd/plugins/rp-pppoe/rp-pppoe.so $INSTALL/etc/ppp/plugins

mkdir -p $INSTALL/usr/sbin
  cp $PKG_DIR/scripts/pppoe-setup $INSTALL/usr/sbin

  cp $PKG_BUILD/scripts/ppp-on  $INSTALL/usr/sbin/pon
  cp $PKG_BUILD/scripts/ppp-off  $INSTALL/usr/sbin/poff
  cp $PKG_BUILD/scripts/ppp-on-dialer  $INSTALL/usr/sbin
  cp $PKG_BUILD/scripts/plog  $INSTALL/usr/sbin
  cp $PKG_BUILD/chat/chat  $INSTALL/usr/sbin
  cp $PKG_BUILD/pppd/pppd  $INSTALL/usr/sbin
  cp $PKG_BUILD/pppd/plugins/rp-pppoe/pppoe-discovery $INSTALL/usr/sbin/
  cp $PKG_BUILD/pppdump/pppdump  $INSTALL/usr/sbin
  cp $PKG_BUILD/pppstats/pppstats    $INSTALL/usr/sbin

mkdir -p $INSTALL/usr/lib/pppd/2.4.5
  cp $PKG_BUILD/pppd/plugins/*.so $INSTALL/usr/lib/pppd/2.4.5

