Skip to content

Commit

Permalink
Reindent the files
Browse files Browse the repository at this point in the history
Signed-off-by: Morten Linderud <[email protected]>
  • Loading branch information
Foxboron committed Apr 28, 2020
1 parent 156ae8a commit 5a5f0fa
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions repro.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ DIFFOSCOPE="diffoscope"
orig_argv=("$0" "$@")
src_owner=${SUDO_USER:-$USER}
function check_root() {
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
exec sudo -- "${orig_argv[@]}"
else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
exec sudo -- "${orig_argv[@]}"
else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi
}

# Use a private gpg keyring
Expand All @@ -34,98 +34,98 @@ function gpg() {
}

function init_gnupg() {
[ ! -d "$BUILDDIRECTORY/_gnupg" ] && mkdir -p "$BUILDDIRECTORY/_gnupg"
[ ! -d "$BUILDDIRECTORY/_gnupg" ] && mkdir -p "$BUILDDIRECTORY/_gnupg"

# ensure signing key is available
gpg --auto-key-locate nodefault,wkd --locate-keys [email protected]
# ensure signing key is available
gpg --auto-key-locate nodefault,wkd --locate-keys [email protected]
}

# Desc: Sets the appropriate colors for output
function colorize() {
# prefer terminal safe colored and bold text when tput is supported
if tput setaf 0 &>/dev/null; then
ALL_OFF="$(tput sgr0)"
BOLD="$(tput bold)"
BLUE="${BOLD}$(tput setaf 4)"
GREEN="${BOLD}$(tput setaf 2)"
RED="${BOLD}$(tput setaf 1)"
YELLOW="${BOLD}$(tput setaf 3)"
else
ALL_OFF="\e[0m"
BOLD="\e[1m"
BLUE="${BOLD}\e[34m"
GREEN="${BOLD}\e[32m"
RED="${BOLD}\e[31m"
YELLOW="${BOLD}\e[33m"
fi
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
# prefer terminal safe colored and bold text when tput is supported
if tput setaf 0 &>/dev/null; then
ALL_OFF="$(tput sgr0)"
BOLD="$(tput bold)"
BLUE="${BOLD}$(tput setaf 4)"
GREEN="${BOLD}$(tput setaf 2)"
RED="${BOLD}$(tput setaf 1)"
YELLOW="${BOLD}$(tput setaf 3)"
else
ALL_OFF="\e[0m"
BOLD="\e[1m"
BLUE="${BOLD}\e[34m"
GREEN="${BOLD}\e[32m"
RED="${BOLD}\e[31m"
YELLOW="${BOLD}\e[33m"
fi
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
}
colorize

# Desc: Message format
function msg() {
local mesg=$1; shift
local mesg=$1; shift
# shellcheck disable=SC2059
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

# Desc: Sub-message format
function msg2() {
local mesg=$1; shift
local mesg=$1; shift
# shellcheck disable=SC2059
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

# Desc: Warning format
function warning() {
local mesg=$1; shift
local mesg=$1; shift
# shellcheck disable=SC2059
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

# Desc: Error format
function error() {
local mesg=$1; shift
local mesg=$1; shift
# shellcheck disable=SC2059
printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

##
# usage : lock( $fd, $file, $message, [ $message_arguments... ] )
##
lock() {
# Only reopen the FD if it wasn't handed to us
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi
# Only reopen the FD if it wasn't handed to us
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi

flock -n "$1"
flock -n "$1"
}

##
# usage : slock( $fd, $file, $message, [ $message_arguments... ] )
##
slock() {
# Only reopen the FD if it wasn't handed to us
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi

if ! flock -sn "$1"; then
flock -s "$1"
fi
# Only reopen the FD if it wasn't handed to us
if ! [[ "/dev/fd/$1" -ef "$2" ]]; then
mkdir -p -- "$(dirname -- "$2")"
eval "exec $1>"'"$2"'
fi

if ! flock -sn "$1"; then
flock -s "$1"
fi
}

##
# usage : lock_close( $fd )
##
lock_close() {
local fd=$1
# https://github.com/koalaman/shellcheck/issues/862
# shellcheck disable=2034
exec {fd}>&-
local fd=$1
# https://github.com/koalaman/shellcheck/issues/862
# shellcheck disable=2034
exec {fd}>&-
}

# Desc: Executes an command inside a given nspawn container
Expand All @@ -134,11 +134,11 @@ lock_close() {
function exec_nspawn(){
local container=$1
systemd-nspawn -q \
--as-pid2 \
--register=no \
--pipe \
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
-D "$BUILDDIRECTORY/$container" "${@:2}"
--as-pid2 \
--register=no \
--pipe \
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
-D "$BUILDDIRECTORY/$container" "${@:2}"
}

# Desc: Removes the root container
Expand Down Expand Up @@ -236,11 +236,11 @@ function init_chroot(){
else

if lock 9 "$BUILDDIRECTORY"/root.lock; then
printf 'Server = %s\n' "$HOSTMIRROR" > "$BUILDDIRECTORY"/root/etc/pacman.d/mirrorlist
exec_nspawn root pacman -Syu --noconfirm
lock_close 9
printf 'Server = %s\n' "$HOSTMIRROR" > "$BUILDDIRECTORY"/root/etc/pacman.d/mirrorlist
exec_nspawn root pacman -Syu --noconfirm
lock_close 9
else
msg "Couldn't acquire lock on root chroot, didn't update."
msg "Couldn't acquire lock on root chroot, didn't update."
fi
fi
trap - ERR INT
Expand Down Expand Up @@ -392,11 +392,11 @@ fi

xdg_repro_dir="${XDG_CONFIG_HOME:-$HOME/.config}/archlinux-repro"
if [[ -r "$xdg_repro_dir/repro.conf" ]]; then
# shellcheck source=/dev/null
source "$xdg_repro_dir/repro.conf"
# shellcheck source=/dev/null
source "$xdg_repro_dir/repro.conf"
elif [[ -r "$HOME/.repro.conf" ]]; then
# shellcheck source=/dev/null
source "$HOME/.repro.conf"
# shellcheck source=/dev/null
source "$HOME/.repro.conf"
fi


Expand Down

0 comments on commit 5a5f0fa

Please sign in to comment.