#!/bin/sh ############################# ## Build script for: oidentd ## Creator: kaneda@bohater.net ## Date: 27 Jul 04 ## Builds package: Yes ## Source location: http://dev.ojnk.net/ ## Downloads Source: Yes ## Build script version: 1.0 ## Requirements: None ## ## Notes: Any special notes the person may need to edit this file. ## ## Include the slackware-pkg conf file if [ -a /etc/slack-package.conf ]; then . /etc/slack-package.conf else echo "Sorry you need to have the slack-package.conf file to run these" echo "please install the slackbuilds package from LinuxPackages.net" exit fi ## Lets set the name of the program here so we can use it later. NAME=oidentd ## Set the versions for packages here, these must match the source file version. PROGRAM_VER=2.0.7 ## Set the BUILD the $MYIN comes from the global config file in /etc BUILD=1$MYIN ## Location to download the source SRC_LOC="http://cesnet.dl.sourceforge.net/sourceforge/ojnk/$NAME-$PROGRAM_VER.tar.gz" ## Set initial variables these should be standard in most packages: PKG=$TMP/package-$NAME ## Now we go grab the source for the user. Again global config has the wget line ## We will check if it is here and if not then download if [ -a $CWD/$NAME-$PROGRAM_VER.tar.gz ]; then echo "Source present not downloading" else $WGET $SRC_LOC || true fi ## Ok time to make sure the area is clean and unarchive the file rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$PROGRAM_VER tar xvzf $CWD/$NAME-$PROGRAM_VER.tar.gz ## Now from this point on we do all the package prep and building. I like to organize them in sections ## like compile, prepare, description, build like below as an example compile() { cd $TMP/$NAME-$PROGRAM_VER chown -R root.root . export CFLAGS=$SLKCFLAGS ./configure --prefix=/usr make make install DESTDIR=$PKG mkdir -p $PKG/etc } ## The next area I use for getting the documents set and maybe config files. prepare() { mkdir -p $PKG/usr/doc/$NAME-$PROGRAM_VER cp -a \ AUTHORS COPYING COPYING.DOC ChangeLog ChangeLog-1.x INSTALL NEWS README TODO \ $PKG/usr/doc/$NAME-$PROGRAM_VER cat > $PKG/etc/oidentd.conf << __END__ # default { # default { # deny spoof # deny spoof_all # deny spoof_privport # allow random_numeric # allow numeric # allow hide # } # } ## Grant all users the ability to generate random numeric ident replies, the ability to gener- ## ate numeric ident replies and the ability to hide their identities on all ident queries. ## Explicitly deny the ability to spoof ident responses. # user root { # default { # force reply "UNKNOWN" # } # } ## Reply with "UNKNOWN" for all successful ident queries for root. # user ryan { # default { # allow spoof # allow spoof_all # allow random # allow hide # } # from 127.0.0.1 { # allow spoof_privport # } # } ## Grant the user "ryan" the capability to spoof ident replies, including the ability to use ## other usernames as ident replies, generate random replies and hide his ident for all connec- ## tions, and grant the user "ryan" the capability to spoof ident replies to privileged ports ## (< 1024) on connections originating from the host 127.0.0.1. __END__ cat > $PKG/etc/oidentd_masq.conf << __END__ ## [/] ## [/] #192.168.1.1 someone UNIX #192.168.1.2 noone WINDOWS #192.168.1.1/32 user1 UNIX #192.168.1.0/24 user3 UNIX #192.168.0.0/16 user4 UNIX #somehost user5 UNIX #192.168.1.0/255.255.255.0 user6 UNIX __END__ mv $PKG/etc/oidentd.conf $PKG/etc/oidentd.conf.new mkdir -p $PKG/install cat > $PKG/install/doinst.sh << __END__ #!/bin/sh config() { NEW="\$1" OLD="\`dirname \$NEW\`/\`basename \$NEW .new\`" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\`cat \$OLD | md5sum\`" = "\`cat \$NEW | md5sum\`" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... } # cp etc/oidentd.conf etc/oidentd.conf.old 2>/dev/null config etc/oidentd.conf.new # rm -f etc/oidentd.conf.new # This won't be needed. The point here is to preserve the permissions of the existing # file, if there is one. I don't see major new development happening in rc.samba... ;-) __END__ ##Some functions from the global config to help with the cleanup ( cd $PKG strip_bin # Strips the libs files reduces the size and removes unneeded cruft strip_lib ) # Every good package should gzip those man pages gzip_man $PKG # Set group ownership for the bin directory #bin_perms $PKG # Set group ownership for the sbin directory sbin_perms $PKG } ## The next area is for the description. You can use this method or just cat a slack-desc file into ## the install area. I will use apache here as a sample description() { mkdir -p $PKG/install cat > $PKG/install/slack-desc << END |-----handy-ruler------------------------------------------------------| oidentd: $NAME $PROGRAM_VER (Configurable IDENT server that supports NAT masq) oidentd: oidentd: oidentd is an ident (rfc1413 compliant) daemon that runs on Linux, oidentd: Darwin, FreeBSD, OpenBSD, NetBSD and Solaris. oidentd can handle IP oidentd: masqueraded/NAT connections on Linux, Darwin, FreeBSD (ipf only), oidentd: OpenBSD and NetBSD. oidentd has a flexible mechanism for specifying oidentd: ident responses. Users can be granted permission to specify their own oidentd: ident responses. Responses can be specified according to host and oidentd: port pairs. oidentd: oidentd: My other Slack packages: http://kaneda.bohater.net/slackware END } ## The last part is the build build() { # Build the package: cd $PKG makepkg -l y -c n $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz mv $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz $PKG_DIR/ echo "Your $NAME package is complete, make sure you open it up before installing it." echo "It is located in $PKG_DIR thanks for your support The Linuxpackages.net Folks" } ### Now we call all those functions in order compile prepare description build