2023-06-26 16:39:42 +02:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
2023-06-26 16:47:13 +02:00
|
|
|
|
# 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
|
|
|
|
|
## }}}
|
|
|
|
|
# }}}
|
|
|
|
|
|
2023-06-26 16:39:42 +02:00
|
|
|
|
# Update repositories
|
|
|
|
|
apt update
|
|
|
|
|
# Install few dependencies
|
|
|
|
|
apt --assume-yes install -- wget
|
|
|
|
|
|
|
|
|
|
# Remove last partition with all free space
|
2023-06-28 10:55:55 +02:00
|
|
|
|
umount /mnt/free
|
|
|
|
|
lvremove --force /dev/mapper/vg-free
|
2023-06-26 16:39:42 +02:00
|
|
|
|
/bin/rmdir --force -- /mnt/free
|
2023-06-28 10:55:55 +02:00
|
|
|
|
/bin/sed --in-place -- ';/mnt/free;d' /etc/fstab
|
2023-06-26 16:39:42 +02:00
|
|
|
|
|
|
|
|
|
# Allow root connection with password
|
|
|
|
|
/bin/sed --in-place -- 's/\(^\|^\#\)\(PermitRootLogin\).*/\2 yes/g' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
|
|
# Download and uncompress latecommand archive
|
|
|
|
|
wget --quiet --output-document=/tmp/latecommand.tar.gz -- "https://git.ipr.univ-rennes1.fr/cellinfo/tftpboot/raw/branch/master/scripts/latecommand.tar.gz"
|
|
|
|
|
tar xzf /tmp/latecommand.tar.gz -C /tmp/
|
|
|
|
|
# Run dedicated script
|
|
|
|
|
## Source /etc/os-release to get Debian codename
|
|
|
|
|
. /etc/os-release
|
|
|
|
|
/bin/sh /tmp/latecommand/post."${VERSION_CODENAME:=bookworm}".sh
|
2023-06-26 16:47:13 +02:00
|
|
|
|
|
|
|
|
|
exit 0
|