# from gudgeon 0.0.git.508.ed10cd9 Name: gudgeon Version: v0.6.25 Release: 1 Summary: A blocking DNS proxy/cache with host/subnet level rules and other features for managing home or small office DNS. License: MIT URL: https://github.com/chrisruffalo/gudgeon VCS: git+https://github.com/chrisruffalo/gudgeon.git#ed10cd97a0dbd73889126f8c9b460e3e1272dc74: Source: gudgeon-0.0.git.508.ed10cd9.tar.gz BuildRequires: git, which, make, automake, gcc, gcc-c++, curl, sqlite, sqlite-devel, glibc, glibc-static, glibc-headers, glibc-devel, npm %description A blocking DNS proxy/cache with host/subnet level rules and other features for managing home or small office DNS. %global debug_package %{nil} %prep # rpkg macro for setup %setup -q -n gudgeon-0.0.git.508.ed10cd9 # get architecture LOCALARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/i686/386/' | sed 's/686/386/' | sed 's/i386/386/') # install go locally if not provided if ! which go; then REMARCHIVE=go1.14.linux-$LOCALARCH.tar.gz if [[ ! -f /tmp/$REMARCHIVE ]]; then curl https://dl.google.com/go/$REMARCHIVE -L -o /tmp/$REMARCHIVE fi rm -rf /tmp/golang mkdir -p /tmp/golang tar xf /tmp/$REMARCHIVE -C /tmp/golang chmod +x /tmp/golang/go/bin/go fi # install newer version of node locally if not over v8 NPMVSORT=$(echo -e "$(nodejs --version || node --version || echo 'v0.0.0')\nv12.0.0" | sort -V | tail -n1) if [[ "v8.0.0" == "${NPMVSORT}" ]]; then # architecture NODEARCH=$(echo "$LOCALARCH" | sed 's/amd64/x64/') # download node for given/provided architecture mkdir -p /tmp/nodejs cd /tmp/nodejs curl https://nodejs.org/dist/latest-v13.x/node-v13.12.0-linux-${NODEARCH}.tar.gz | tar xz --strip-components=1 PATH="/tmp/nodejs/bin:$PATH" node --version cd - # configure npm install prefix echo prefix = /tmp/npm >> ~/.npmrc curl -L https://www.npmjs.org/install.sh | sh PATH="/tmp/npm/bin:$PATH" npm --version fi %build export PATH="/tmp/golang/go/bin:/tmp/npm/bin:/tmp/nodejs/bin:$PATH" go version export VERSION=v0.6.25 export NUMBER=v0.6.25 export GITHASH= export GOOS_LIST=linux export GARCH_LIST=$(uname -m) make prepare make npm make webpack make build %install %make_install %files %license LICENSE /bin/gudgeon %config(noreplace) /etc/gudgeon/gudgeon.yml %config(noreplace) /etc/gudgeon /var/lib/gudgeon %config(noreplace) /lib/systemd/system/gudgeon.socket %config(noreplace) /lib/systemd/system/gudgeon.service %ghost /var/log/gudgeon %pre USER_EXISTS=$(id -u gudgeon) if [[ "0" != "$?" ]]; then useradd gudgeon -s /sbin/nologin || true fi %post # change ownership of directories chown -R :gudgeon /etc/gudgeon chown -R gudgeon:gudgeon /var/lib/gudgeon # mod gudgeon user for files created/owned by install usermod gudgeon -d /var/lib/gudgeon || true # reload daemon files systemctl daemon-reload # restart service only if it is already running to pick up the new version IS_RUNNING=$(systemctl is-active gudgeon) if [[ "active" == "${IS_RUNNING}" ]]; then systemctl restart gudgeon fi