Add FreeBSD support (#172)
This commit is contained in:
committed by
Tom Limoncelli
parent
3e9091722c
commit
fba77f092a
@@ -374,7 +374,7 @@ function file_contains_line() {
|
|||||||
function md5sum_file() {
|
function md5sum_file() {
|
||||||
# Portably generate the MD5 hash of file $1.
|
# Portably generate the MD5 hash of file $1.
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
md5 -r "$1" | awk '{ print $1 }'
|
md5 -r "$1" | awk '{ print $1 }'
|
||||||
;;
|
;;
|
||||||
Linux | CYGWIN* | MINGW* )
|
Linux | CYGWIN* | MINGW* )
|
||||||
@@ -390,7 +390,7 @@ function md5sum_file() {
|
|||||||
function cp_permissions() {
|
function cp_permissions() {
|
||||||
# Copy the perms of $1 onto $2 .. end.
|
# Copy the perms of $1 onto $2 .. end.
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
chmod $( stat -f '%p' "$1" ) "${@:2}"
|
chmod $( stat -f '%p' "$1" ) "${@:2}"
|
||||||
;;
|
;;
|
||||||
Linux | CYGWIN* | MINGW* )
|
Linux | CYGWIN* | MINGW* )
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function create_self_deleting_tempfile() {
|
|||||||
local filename
|
local filename
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
: "${TMPDIR:=/tmp}" ;
|
: "${TMPDIR:=/tmp}" ;
|
||||||
filename=$(mktemp -t _stacklib_.XXXXXXXX )
|
filename=$(mktemp -t _stacklib_.XXXXXXXX )
|
||||||
;;
|
;;
|
||||||
@@ -74,7 +74,7 @@ function create_self_deleting_tempdir() {
|
|||||||
local filename
|
local filename
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
: "${TMPDIR:=/tmp}" ;
|
: "${TMPDIR:=/tmp}" ;
|
||||||
filename=$(mktemp -d -t _stacklib_.XXXXXXXX )
|
filename=$(mktemp -d -t _stacklib_.XXXXXXXX )
|
||||||
;;
|
;;
|
||||||
@@ -98,7 +98,7 @@ function make_self_deleting_tempfile() {
|
|||||||
local name
|
local name
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
: "${TMPDIR:=/tmp}" ;
|
: "${TMPDIR:=/tmp}" ;
|
||||||
name=$(mktemp -t _stacklib_.XXXXXXXX )
|
name=$(mktemp -t _stacklib_.XXXXXXXX )
|
||||||
;;
|
;;
|
||||||
@@ -120,7 +120,7 @@ function make_tempdir() {
|
|||||||
local name
|
local name
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
: "${TMPDIR:=/tmp}" ;
|
: "${TMPDIR:=/tmp}" ;
|
||||||
name=$(mktemp -d -t _stacklib_.XXXXXXXX )
|
name=$(mktemp -d -t _stacklib_.XXXXXXXX )
|
||||||
;;
|
;;
|
||||||
@@ -157,7 +157,7 @@ function fail_if_not_running_as_root() {
|
|||||||
function fail_if_in_root_directory() {
|
function fail_if_in_root_directory() {
|
||||||
# Verify nobody has tricked us into being in "/".
|
# Verify nobody has tricked us into being in "/".
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin )
|
Darwin | FreeBSD )
|
||||||
if [[ $(stat -f'%i' / ) == $(stat -f'%i' . ) ]] ; then
|
if [[ $(stat -f'%i' / ) == $(stat -f'%i' . ) ]] ; then
|
||||||
echo 'SECURITY ALERT: The current directory is the root directory.'
|
echo 'SECURITY ALERT: The current directory is the root directory.'
|
||||||
echo 'Exiting...'
|
echo 'Exiting...'
|
||||||
|
|||||||
Reference in New Issue
Block a user