Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -xu
- src_dir="/usr/src"
- if test "$(id -u)" != "0"
- then
- echo "Error: this script must be run as root."
- exit 1
- fi
- git_revision=$(uname -v | cut -d'#' -f2 | cut -d' ' -f2 | cut -d'(' -f1)
- if test -z "$git_revision"
- then
- echo "Error: unable to detect TrueOS git revision."
- exit 1
- fi
- git_branch=$(uname -v | cut -d'#' -f2 | cut -d' ' -f2 | cut -d'(' -f2 | cut -d')' -f1)
- if test -z "$git_branch"
- then
- echo "Error: unable to detect TrueOS git branch."
- exit 1
- fi
- if test -z "$(ls -A /usr/src)"
- then
- mkdir -p "$src_dir"
- if ! git clone -b "$git_branch" https://github.com/trueos/freebsd "$src_dir"
- then
- exit 1
- fi
- fi
- if cd "$src_dir"
- then
- git checkout "$git_revision"
- fi
- set +xu
Advertisement
Add Comment
Please, Sign In to add comment