Skip to content

Commit

Permalink
informative text to /dev/stderr not /dev/null
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
  • Loading branch information
LucasLarson committed Oct 8, 2023
1 parent d2be327 commit 8f595fa
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ elif command -v -- apt-get >/dev/null 2>&1; then
alias install='command apt-get install --verbose --show-progress --assume-yes'
fi

printf -- '\n\n .\137\137 .\137\137 \137\137\n' 2>/dev/null
printf -- ' \174\137\137\174 \137\137\137\137 \174\137\137\174\057 \174\137\n' 2>/dev/null
printf -- ' \174 \174\057 \134\174 \134 \137\137\134\n' 2>/dev/null
printf -- ' \174 \174 \174 \134 \174\174 \174\n' 2>/dev/null
printf -- ' \174\137\137\174\137\137\137\174' 2>/dev/null
printf -- ' \057\137\137\174\174\137\137\174\n' 2>/dev/null
printf -- ' \134\057\n\n' 2>/dev/null
printf -- ' Linux setup\n' 2>/dev/null
printf -- '\n\n .\137\137 .\137\137 \137\137\n' >&2
printf -- ' \174\137\137\174 \137\137\137\137 \174\137\137\174\057 \174\137\n' >&2
printf -- ' \174 \174\057 \134\174 \134 \137\137\134\n' >&2
printf -- ' \174 \174 \174 \134 \174\174 \174\n' >&2
printf -- ' \174\137\137\174\137\137\137\174' >&2
printf -- ' \057\137\137\174\174\137\137\174\n' >&2
printf -- ' \134\057\n\n' >&2
printf -- ' Linux setup\n' >&2
command sleep 1
printf -- ' a Lucas Larson production\n\n' 2>/dev/null
printf -- ' a Lucas Larson production\n\n' >&2
command sleep 1

# start from `$HOME`
Expand Down Expand Up @@ -59,7 +59,7 @@ command sed -e '1q' /etc/os-release 2>/dev/null | command grep -q -e 'Arch Linux
command -v -- apk >/dev/null 2>&1 || {
# trust apk only if it matches a known checksum
{ set +o xtrace; } 2>/dev/null
printf -- 'verifying apk tools integrity...\n' 2>/dev/null
printf -- 'verifying apk tools integrity...\n' >&2
set -o xtrace
test "$(command wget --output-document=- --quiet -- 'https://web.archive.org/web/20221114182828id_/dl-cdn.alpinelinux.org/alpine/v3.16/main/x86/apk-tools-static-2.12.9-r3.apk' | command cksum)" != '3008894084 1363723'
} || {
Expand All @@ -78,7 +78,7 @@ command -v -- apk >/dev/null 2>&1 || {

# update
{ set +o xtrace; } 2>/dev/null
printf -- 'updating Alpine Linux repositories...\n' 2>/dev/null
printf -- 'updating Alpine Linux repositories...\n' >&2
set -o xtrace
command apk update --verbose --progress
command apk upgrade --verbose --progress
Expand All @@ -90,19 +90,19 @@ command apk upgrade --verbose --progress
test -d '/usr/share/man/man4' &&
test -d '/usr/share/man/man6'; } || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing man pages...\n' 2>/dev/null
printf -- 'installing man pages...\n' >&2
set -o xtrace
install man-pages
}
command -v -- mandoc >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing mandoc for man pages...\n' 2>/dev/null
printf -- 'installing mandoc for man pages...\n' >&2
set -o xtrace
install mandoc mandoc-doc
}
command -v -- less >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing less to read man pages...\n' 2>/dev/null
printf -- 'installing less to read man pages...\n' >&2
set -o xtrace
install less less-doc
}
Expand All @@ -114,7 +114,7 @@ install coreutils coreutils-doc
{ test -x '/usr/bin/coreutils' &&
command find --version >/dev/null 2>&1 | command grep -q -e 'findutils'; } || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing Linux utilities...\n' 2>/dev/null
printf -- 'installing Linux utilities...\n' >&2
set -o xtrace
}
install util-linux util-linux-doc pciutils pciutils-doc usbutils usbutils-doc coreutils coreutils-doc binutils binutils-doc findutils findutils-doc grep grep-doc wget wget-doc curl curl-doc openssl openssl-doc sudo sudo-doc sed sed-doc attr attr-doc dialog dialog-doc bash bash-doc bash-completion bash-completion-doc readline readline-doc
Expand All @@ -129,7 +129,7 @@ command apk update
# https://wiki.alpinelinux.org/w/index.php?oldid=13842&title=Setting_up_a_ssh-server#OpenSSH
test -d '/etc/ssh' || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing OpenSSH...\n' 2>/dev/null
printf -- 'installing OpenSSH...\n' >&2
set -o xtrace
install openssh openssh-doc
}
Expand All @@ -138,15 +138,15 @@ test -d '/etc/ssh' || {
# https://wiki.alpinelinux.org/w/index.php?oldid=17295&title=Setting_up_a_laptop#Creating_GPG_keys
test -x '/usr/bin/gpg2' || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing GPG...\n' 2>/dev/null
printf -- 'installing GPG...\n' >&2
set -o xtrace
install gnupg gnupg-doc
}

# git
command -v -- git >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing Git...\n' 2>/dev/null
printf -- 'installing Git...\n' >&2
set -o xtrace
install git git-doc
}
Expand All @@ -163,58 +163,58 @@ command git config --global --get init.defaultBranch >/dev/null 2>&1 || {

# time zone
{ set +o xtrace; } 2>/dev/null
printf -- 'updating time zone information...\n' 2>/dev/null
printf -- 'updating time zone information...\n' >&2
set -o xtrace
install --no-cache tzdata tzdata-doc

# python
{ set +o xtrace; } 2>/dev/null
printf -- 'checking Python installation...\n' 2>/dev/null
printf -- 'checking Python installation...\n' >&2
set -o xtrace
command -v -- python >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing Python...\n' 2>/dev/null
printf -- 'installing Python...\n' >&2
set -o xtrace
install python3 python3-doc
}

# pip
{ set +o xtrace; } 2>/dev/null
printf -- 'checking Python package manager installation...\n' 2>/dev/null
printf -- 'checking Python package manager installation...\n' >&2
set -o xtrace
command -v -- pip >/dev/null 2>&1 && {
{ set +o xtrace; } 2>/dev/null
printf -- 'updating pip...\n' 2>/dev/null
printf -- 'updating pip...\n' >&2
set -o xtrace
command python3 -m pip install --upgrade pip 2>/dev/null
} || {
{ set +o xtrace; } 2>/dev/null
{
printf -- 'installing pip...\n'
printf -- 'verifying integrity of pip bootstrap file...\n'
} 2>/dev/null
} >&2
set -o xtrace
test "$(command curl --fail --silent --location 'https://web.archive.org/web/20221114002029id_/bootstrap.pypa.io/get-pip.py' | command cksum)" != '3397773170 2569500'
} || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing pip using bootstrap...\n' 2>/dev/null
printf -- 'this may take a while...\n' 2>/dev/null
printf -- 'installing pip using bootstrap...\n' >&2
printf -- 'this may take a while...\n' >&2
set -o xtrace
command curl 'https://web.archive.org/web/20221114002029id_/bootstrap.pypa.io/get-pip.py' | command python3
}

# mackup
command -v -- mackup >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing mackup...\n' 2>/dev/null
printf -- 'installing mackup...\n' >&2
set -o xtrace
command pip install --upgrade mackup
}

# zsh
command -v -- zsh >/dev/null 2>&1 || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing Zsh...\n' 2>/dev/null
printf -- 'installing Zsh...\n' >&2
set -o xtrace
install zsh zsh-doc
}
Expand All @@ -230,7 +230,7 @@ command -v -- omz >/dev/null 2>&1 ||
test -d "${ZSH:=${HOME%/}/.oh-my-zsh}" ||
test "$(command curl --fail --silent --location 'https://web.archive.org/web/20210520175616id_/raw.githubusercontent.com/ohmyzsh/ohmyzsh/02d07f3e3dba0d50b1d907a8062bbaca18f88478/tools/install.sh' | command cksum)" != '1976015298 9942' || {
{ set +o xtrace; } 2>/dev/null
printf -- 'installing Oh My Zsh...\n' 2>/dev/null
printf -- 'installing Oh My Zsh...\n' >&2
if command -v -- wget >/dev/null 2>&1; then
set -o xtrace
sh -c "$(command wget 'https://web.archive.org/web/20210520175616id_/raw.githubusercontent.com/ohmyzsh/ohmyzsh/02d07f3e3dba0d50b1d907a8062bbaca18f88478/tools/install.sh' --output-document=-)" "" --unattended --keep-zshrc
Expand All @@ -243,32 +243,32 @@ command -v -- omz >/dev/null 2>&1 ||

# update, repair everything again before close
{ set +o xtrace; } 2>/dev/null
printf -- 'updating...\n' 2>/dev/null
printf -- 'updating...\n' >&2
set -o xtrace
command apk update --verbose --verbose --progress

{ set +o xtrace; } 2>/dev/null
printf -- 'upgrading...\n' 2>/dev/null
printf -- 'upgrading...\n' >&2
set -o xtrace
command apk upgrade --verbose --verbose --progress

{ set +o xtrace; } 2>/dev/null
printf -- 'repairing and resolving dependencies...\n' 2>/dev/null
printf -- 'repairing and resolving dependencies...\n' >&2
set -o xtrace
command apk fix --verbose --verbose --depends --progress

{ set +o xtrace; } 2>/dev/null
printf -- 'verifying installations...\n' 2>/dev/null
printf -- 'verifying installations...\n' >&2
set -o xtrace
command apk verify --verbose --verbose --progress && {
{ set +o xtrace; } 2>/dev/null
printf -- 'verified\n' 2>/dev/null
printf -- 'verified\n' >&2
set -o xtrace
}

# cleanup
{ set +o xtrace; } 2>/dev/null
printf -- 'cleaning up temporary installation files and performing housekeeping...\n' 2>/dev/null
printf -- 'cleaning up temporary installation files and performing housekeeping...\n' >&2
set -o xtrace

# message of the day
Expand Down Expand Up @@ -337,9 +337,9 @@ test -w '/etc/passwd' &&

# done
{ set +euvx; } 2>/dev/null
printf -- 'installation complete\n' 2>/dev/null
printf -- 'installation complete\n' >&2
command sleep 1
printf -- 'exiting to apply updates...\n' 2>/dev/null
printf -- 'exiting to apply updates...\n' >&2

# restore `$PS4`
PS4="${ps4_temporary:-+ }"
Expand All @@ -348,6 +348,6 @@ unset -v -- ps4_temporary
{
printf -- '\n'
printf -- 'done!\n'
} 2>/dev/null
} >&2

exit

0 comments on commit 8f595fa

Please sign in to comment.