From eaf2c42446a893455e205400e679ae44cef58a6c Mon Sep 17 00:00:00 2001 From: Mar Alegre Date: Thu, 3 Dec 2020 17:37:45 -0500 Subject: [PATCH] working on install script --- .install/bin/pdm-build | 2 +- install.sh | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.install/bin/pdm-build b/.install/bin/pdm-build index 9b3bb7b..a41dc0f 100755 --- a/.install/bin/pdm-build +++ b/.install/bin/pdm-build @@ -34,7 +34,7 @@ Options: -d Debug mode: don't delete the temporary container created by the script when encountering an error -t [tag] Tag the image with the given string. Can be used multiple times to assign - the image multiple tags + multiple tags -h Display this help and exit" # Handle options diff --git a/install.sh b/install.sh index 0975359..f196c9e 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Main -set -e +set -eEuo pipefail +trap 'echo "Error detected: aborting installation."' ERR echo "Attempting to autodetect distro ..." distro=$(lsb_release -is) @@ -31,18 +31,26 @@ fi echo "Copying scripts to /usr/local/bin ..." # copy bin files to /usr/local/bin -sudo cp install/bin/* /usr/local/bin/ -# copy shflags to /usr/local/bin as well -sudo cp install/shflags /usr/local/bin/ +sudo cp .install/bin/* /usr/local/bin/ echo "Installing containers startup service ..." # install systemd startup service -sudo cp install/containers-startup.service /etc/systemd/system/ +sudo cp .install/containers-startup.service /etc/systemd/system/ sudo systemctl enable containers-startup.service # create startup.sh if it doesn't exist if [[ ! -f /etc/containers/startup.sh ]]; then - printf "#!/bin/bash\n\n" | sudo tee /etc/containers/startup.sh + printf "#!/bin/bash\n\n" | sudo tee /etc/containers/startup.sh > /dev/null + echo "Installed containers startup script in /etc/containers/startup.sh" + echo "Put any podman-related commands that should run on startup in that file." +else + echo "Not overwriting /etc/containers/startup.sh as it already exists." fi sudo chmod +x /etc/containers/startup.sh -echo "Installed containers startup script in /etc/containers/startup.sh." -echo "Put any podman-related commands that should run on startup in that file." + +if id -u containers; then + echo "Configuring user 'containers' ..." + +echo 'Creating "containers" user ...' + + +echo "Install finished successfully."