diff options
Diffstat (limited to 'source/n/openresolv')
-rw-r--r-- | source/n/openresolv/doinst.sh | 18 | ||||
-rw-r--r-- | source/n/openresolv/openresolv-3.12.0.tar.xz.distinfo | 1 | ||||
-rwxr-xr-x | source/n/openresolv/openresolv.SlackBuild | 134 | ||||
-rw-r--r-- | source/n/openresolv/openresolv.url | 1 | ||||
-rw-r--r-- | source/n/openresolv/slack-desc | 19 | ||||
-rw-r--r-- | source/n/openresolv/update-resolv-conf | 54 |
6 files changed, 227 insertions, 0 deletions
diff --git a/source/n/openresolv/doinst.sh b/source/n/openresolv/doinst.sh new file mode 100644 index 00000000..810b1c10 --- /dev/null +++ b/source/n/openresolv/doinst.sh @@ -0,0 +1,18 @@ +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... +} + +config etc/resolvconf.conf.new +# This file is optional (added with OPENVPN=yes); let's make sure it exists +if [ -e etc/openvpn/update-resolv-conf.new ]; then + config etc/openvpn/update-resolv-conf.new +fi diff --git a/source/n/openresolv/openresolv-3.12.0.tar.xz.distinfo b/source/n/openresolv/openresolv-3.12.0.tar.xz.distinfo new file mode 100644 index 00000000..c2f8e4a1 --- /dev/null +++ b/source/n/openresolv/openresolv-3.12.0.tar.xz.distinfo @@ -0,0 +1 @@ +SHA256 (openresolv-3.12.0.tar.xz) = 42b30508e857a228535c631eaac936862d86eca68c14b5c0bf387ba176b91b97 diff --git a/source/n/openresolv/openresolv.SlackBuild b/source/n/openresolv/openresolv.SlackBuild new file mode 100755 index 00000000..85c340e9 --- /dev/null +++ b/source/n/openresolv/openresolv.SlackBuild @@ -0,0 +1,134 @@ +#!/bin/bash + +# Copyright 2012-2013 synbq Bucharest +# Copyright 2017-2021 Jeremy Hansen <jebrhansen+SBo -at- gmail.com> +# Copyright 2021 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=openresolv +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1} + +# Set this option to yes to add an optional config script for OpenVPN: +OPENVPN=${OPENVPN:-no} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$(uname -m) ;; + esac + export ARCH +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-noarch-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j $(expr $(nproc) + 1) "} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "armv7hl" ]; then + SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1 +cd $PKGNAM-$VERSION || exit 1 + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libexecdir=/usr/libexec/openresolv \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux + +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 + +mv $PKG/etc/resolvconf.conf $PKG/etc/resolvconf.conf.new +if [ "${OPENVPN}" = "yes" ]; then + mkdir -p $PKG/etc/openvpn + install -m 0755 $CWD/update-resolv-conf $PKG/etc/openvpn/update-resolv-conf.new +fi + +## There are no ELF objects in this package... +## Strip binaries: +#find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +# Compress manual pages: +find $PKG/usr/man -type f -exec gzip -9 {} \+ +for i in $( find $PKG/usr/man -type l ) ; do + ln -s $( readlink $i ).gz $i.gz + rm $i +done + +# Add a documentation directory: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +cp -a \ + LICENSE* COPYING* README* \ + $PKG/usr/doc/${PKGNAM}-$VERSION + +mkdir -p $PKG/install +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-noarch-$BUILD.txz diff --git a/source/n/openresolv/openresolv.url b/source/n/openresolv/openresolv.url new file mode 100644 index 00000000..1ca43733 --- /dev/null +++ b/source/n/openresolv/openresolv.url @@ -0,0 +1 @@ +https://roy.marples.name/downloads/openresolv/ diff --git a/source/n/openresolv/slack-desc b/source/n/openresolv/slack-desc new file mode 100644 index 00000000..c4d8a732 --- /dev/null +++ b/source/n/openresolv/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +openresolv: openresolv (management framework for resolv.conf) +openresolv: +openresolv: Allows multiple daemons to manage resolv.conf and configures local +openresolv: resolvers such as dnsmasq and unbound. +openresolv: This package may require some manual configuration. +openresolv: Please read resolvconf(8) and resolvconf.conf(5) for detailed +openresolv: instructions. +openresolv: +openresolv: Homepage: https://roy.marples.name/projects/openresolv +openresolv: +openresolv: diff --git a/source/n/openresolv/update-resolv-conf b/source/n/openresolv/update-resolv-conf new file mode 100644 index 00000000..a2026057 --- /dev/null +++ b/source/n/openresolv/update-resolv-conf @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Parses DHCP options from openvpn to update resolv.conf +# To use set as 'up' and 'down' script in your openvpn *.conf: +# up /etc/openvpn/update-resolv-conf +# down /etc/openvpn/update-resolv-conf +# +# Used snippets of resolvconf script by Thomas Hood <jdthood@yahoo.co.uk> +# and Chris Hanson +# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. +# +# 05/2006 chlauber@bnc.ch +# +# Example envs set from openvpn: +# foreign_option_1='dhcp-option DNS 193.43.27.132' +# foreign_option_2='dhcp-option DNS 193.43.27.133' +# foreign_option_3='dhcp-option DOMAIN be.bnc.ch' + +[ -x /usr/sbin/resolvconf ] || exit 0 + +case $script_type in + +up) + for optionname in ${!foreign_option_*} ; do + option="${!optionname}" + echo $option + part1=$(echo "$option" | cut -d " " -f 1) + if [ "$part1" == "dhcp-option" ] ; then + part2=$(echo "$option" | cut -d " " -f 2) + part3=$(echo "$option" | cut -d " " -f 3) + if [ "$part2" == "DNS" ] ; then + IF_DNS_NAMESERVERS="$IF_DNS_NAMESERVERS $part3" + fi + if [ "$part2" == "DOMAIN" ] ; then + IF_DNS_SEARCH="$IF_DNS_SEARCH $part3" + fi + fi + done + R="" + for SS in $IF_DNS_SEARCH ; do + R="${R}search $SS +" + done + for NS in $IF_DNS_NAMESERVERS ; do + R="${R}nameserver $NS +" + done + echo -n "$R" | /usr/sbin/resolvconf -x -a "${dev}.inet" + ;; +down) + /usr/sbin/resolvconf -d "${dev}.inet" + ;; +esac + |