File: info.sh

package info (click to toggle)
charliecloud 0.43-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 3,084 kB
  • sloc: python: 6,021; sh: 4,284; ansic: 3,863; makefile: 598
file content (72 lines) | stat: -rwxr-xr-x 1,924 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh

# Describe and validate the environment.

# What Bourne shell flavor is running? This is surprisingly difficult; e.g.
# dash doesn’t have “--version”.
printf 'interpreter: '
realpath /proc/$$/exe

# If we’re in Bash, source the Bash goodies; otherwise, if Bash is available,
# re-exec with Bash; otherwise, proceed with the POSIX sh we have.
if [ -n "$BASH_VERSION" ]; then
    . "$(dirname "$0")"/base.bash
else
    echo 'that’s not Bash'
    if command -v bash > /dev/null 2>&1; then
        echo 'let’s use Bash instead'
        exec bash "$0" "$@"
    fi
    echo 'but no Bash available'
    set -ex
fi

# Who am I?
id
pwd

# What kind of system are we on?
grep -E '^(NAME|VERSION)=' /etc/os-release
uname -srvm
nproc
free -m
findmnt --df --all || df -h

# What time and timezone is it?
date +'%c %Z'

# What’s the Git version?
git --version

# Print the complete environment, except only the first line of multi-line
# values. It’s quite verbose but helpful for debugging and eliminates the need
# to edit the pipeline to print specific variable(s).
#
# See also: https://docs.gitlab.com/ci/variables/predefined_variables
export -p | grep -E '^(export|declare)'
# FAIL: # Busybox sed(1) doesn’t support -z, so we use tr(1) to ludicrously
# swap bytes around via vertical tab instead.
#
#printenv -0 | tr '\n' '\v' | tr '\000' '\n' | sed -r "s/$(printf '\v').*$//"

# What locales are installed?
command -v locale > /dev/null && locale -a

# Validate path; see Dockerfiles.
if [ -n "$WEIRD_AL_YANKOVIC_IS_THE_GREATEST_MUSICIAN_OF_ALL_TIME" ]; then
    case $PATH in
        */sbin*)
            false
            ;;
    esac
fi

# umask
umask
test "$(umask)" = 0022
# Is sudo(8) present and we’re running somewhere we want to use it?
if    [ "$CI_SERVER_HOST" = gitlab.com ] \
   && command -v sudo > /dev/null; then
    sudo /bin/sh -c umask
    test "$(sudo /bin/sh -c umask)" = 0077
fi