#!/bin/sh # # buildprep - prepare your system for a cvs-fast-export source build. # # Use the -n option to dry-run this command, showing what would be done # without actually doing it # # This script swiped from NTPsec. # Set the defaults DRYRUN="no" DOC="no" OS=$(uname -s) # Loop through option flags for optflag in "$@" do case "$optflag" in -h|--help) cat </dev/null then installer=emerge install="$do $installer -q y" elif yum version 2>/dev/null then installer=yum install="$do $installer -y install" elif dnf --version >/dev/null 2>&1 then installer=dnf install="$do $installer -y install" elif apt-get --version >/dev/null 2>&1 then installer=apt install="$do apt-get install -qy" elif zypper -h >/dev/null 2>&1 then # OpenSUSE prefers zypper over yast installer=zypper install="$do $installer install -y" elif yast -h >/dev/null 2>&1 then installer=yast install="$do $installer --install" elif apk --version >/dev/null 2>&1 then # Alpine Linux, musl rather than glibc installer=apk install="$do $installer add" elif command -v pacman then # Arch Linux installer=pacman install="$do $installer -S --needed --noconfirm" elif [ "$OS" = "NetBSD" ] then if pkgin -v then # NetBSD binary package installer installer=pkgin install="$do $installer install" else echo "## Looks like a NetBSD system" echo "## You need to setup pkgin" echo "## The last page of install disk has a check-box to do it" echo "## But you don't get that option on a Raspberry Pi." echo "## For the Pi, do something like:" echo "## pkg_add ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/earmv7hf/8.0/All/pkgin-0.9.4nb8.tgz" echo "## Adjust the version and arch to match your setup." exit 1 fi elif [ "$OS" = "FreeBSD" ] then if pkg -v then # FreeBSD binary package installer installer=pkg install="$do $installer install" fi else echo "# ERROR: Package manager unidentified - Unsupported operating system" exit 1 fi echo "# Your package installer is ${installer}." echo "" main () { # Prerequisites to build the daemon: bison, pps-tools, service libraries case $installer in apk) echo "Not yet supported" >&2 exit 1 ;; apt) # tzdata needs to be installed explicitly so it won't try an interactive # configuration when pulled as a dependency. This package doesn't care # whether your Python is 2.x or 3.x. $install tzdata $install make grep sed gcc bison flex python3 git rcs cvs pylint cppcheck shellcheck ;; emerge) echo "Not yet supported" >&2 exit 1 ;; pacman) $install tzdata $install make grep sed gcc bison flex python git rcs cvs \ python-pylint cppcheck shellcheck ;; pkgin) echo "Not yet supported" >&2 exit 1 ;; pkg) echo "Not yet supported" >&2 exit 1 ;; yum) echo "Not yet supported" >&2 exit 1 ;; dnf) $install tzdata $install make grep sed gcc bison flex rcs cvs pylint cppcheck ShellCheck ;; yast) echo "Not yet supported" >&2 exit 1 ;; zypper) echo "Not yet supported" >&2 exit 1 ;; esac } doc () { # prerequisites to build documentation case $installer in apk) echo "Not yet supported" >&2 exit 1 ;; apt) $install asciidoc ;; emerge) echo "Not yet supported" >&2 exit 1 ;; pacman) $install asciidoc ;; pkgin) echo "Not yet supported" >&2 exit 1 ;; pkg) echo "Not yet supported" >&2 exit 1 ;; yum) echo "Not yet supported" >&2 exit 1 ;; dnf) $install asciidoc ;; yast|zypper) echo "Not yet supported" >&2 exit 1 ;; esac } # Main sequence main if [ "$DOC" = "yes" ] then doc else echo "" echo "# Skipping documentation dependencies [--doc]" fi echo "" echo "# Done." # end