Add purpose, flags and return value

This commit is contained in:
gardouille 2023-06-26 16:47:13 +02:00
parent 15453a7972
commit 064ac3b851
Signed by: gardouille
GPG Key ID: E759BAA22501AF32

View File

@ -1,5 +1,34 @@
#!/bin/sh
# Purpose {{{
# This script should be called at the end of a OVH Debian installation
# 1. Update APT repositories and install few dependencies.
# 2. Umount and remove temp Logical Volume (with all free space).
# 3. Allow SSH connection with a password for root.
# 4. Download and extract a latecommand archive.
# 5. Source /etc/os-release file to have $VERSION_CODENAME variable.
# 6. Run last post-install script dedicated to Debian Codename.
#
# 2023-06-26
# }}}
# Flags {{{
## Exit on error {{{
set -o errexit
## }}}
## Exit on unset var {{{
### Use "${VARNAME-}" to test a var that may not have been set
set -o nounset
## }}}
## Pipeline command is treated as failed {{{
### Not available in POSIX sh https://github.com/koalaman/shellcheck/wiki/SC3040
#set -o pipefail
## }}}
## Help with debugging {{{
### Call the script by prefixing it with "TRACE=1 ./script.sh"
if [ "${TRACE-0}" -eq 1 ]; then set -o xtrace; fi
## }}}
# }}}
# Update repositories
apt update
# Install few dependencies
@ -21,3 +50,5 @@ tar xzf /tmp/latecommand.tar.gz -C /tmp/
## Source /etc/os-release to get Debian codename
. /etc/os-release
/bin/sh /tmp/latecommand/post."${VERSION_CODENAME:=bookworm}".sh
exit 0