Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[teleport-update] Move teleport binaries to new path {deb,rpm} #49110

Merged
merged 19 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
65b4088
Move teleport binaries to new path
vapopov Nov 16, 2024
cc23056
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 19, 2024
3ac63a0
Use link/unlink command to manage links
vapopov Nov 19, 2024
80de703
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 19, 2024
4855745
Move teleport binaries under standard path for distroless
vapopov Nov 20, 2024
89b32da
Fix wrong move path
vapopov Nov 20, 2024
a16f9c6
Create missing directory
vapopov Nov 20, 2024
a1da9f1
Rename link/unlink commands
vapopov Nov 20, 2024
981c042
Exclude teleport-update from docker image
vapopov Nov 20, 2024
28c5e93
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 20, 2024
df249f2
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 21, 2024
7ebb1e2
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Nov 22, 2024
dd5594d
Add teleport-update to AMI image build
vapopov Nov 22, 2024
62ee8c3
Fix RPM build, fpm automatically manage scripts
vapopov Nov 22, 2024
d109f68
Fix AMI build, add missing teleport.service
vapopov Nov 22, 2024
98b8149
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 5, 2024
8a0fb1f
Move binaries to /opt/teleport/system
vapopov Dec 5, 2024
7b428d0
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 13, 2024
347710f
Merge remote-tracking branch 'origin/master' into vapopov/build-telep…
vapopov Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions build.assets/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TARBALL_DIRECTORY="$s"
GNUPG_DIR=${GNUPG_DIR:-/tmp/gnupg}

# linux package configuration
LINUX_BINARY_DIR=/usr/local/bin
LINUX_BINARY_DIR=/usr/local/teleport-system/bin
LINUX_SYSTEMD_DIR=/lib/systemd/system
LINUX_CONFIG_DIR=/etc
LINUX_DATA_DIR=/var/lib/teleport
Expand Down Expand Up @@ -226,8 +226,8 @@ if [[ "${PACKAGE_TYPE}" == "pkg" ]]; then
PKG_FILENAME="teleport-bin-${TELEPORT_VERSION}${ARCH_TAG}.${PACKAGE_TYPE}"
fi
else
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/examples/systemd/teleport.service ${TAR_PATH}/examples/systemd/post-upgrade"
LINUX_BINARY_FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport"
FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/teleport ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport-update ${TAR_PATH}/examples/systemd/teleport.service ${TAR_PATH}/examples/systemd/post-install"
LINUX_BINARY_FILE_LIST="${TAR_PATH}/tsh ${TAR_PATH}/tctl ${TAR_PATH}/tbot ${TAR_PATH}/fdpass-teleport ${TAR_PATH}/teleport ${TAR_PATH}/teleport-update"
LINUX_SYSTEMD_FILE_LIST="${TAR_PATH}/examples/systemd/teleport.service"
EXTRA_DOCKER_OPTIONS=""
RPM_SIGN_STANZA=""
Expand Down Expand Up @@ -291,8 +291,8 @@ if [[ "${PACKAGE_TYPE}" != "pkg" ]]; then
CONFIG_FILE_STANZA="--config-files /src/buildroot${LINUX_CONFIG_DIR}/${LINUX_CONFIG_FILE} "
fi

# include post-upgrade script
mv -v ${TAR_PATH}/examples/systemd/post-upgrade ${PACKAGE_TEMPDIR}
# include post-install script
mv -v ${TAR_PATH}/examples/systemd/post-install ${PACKAGE_TEMPDIR}

# /var/lib/teleport
# shellcheck disable=SC2174
Expand Down Expand Up @@ -369,7 +369,7 @@ else
--provides teleport \
--prefix / \
--verbose \
--after-upgrade /src/post-upgrade \
--after-install /src/post-install \
${CONFIG_FILE_STANZA} \
${FILE_PERMISSIONS_STANZA} \
${RPM_SIGN_STANZA} .
Expand Down
60 changes: 60 additions & 0 deletions examples/systemd/post-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

# this post upgrade script is run each time the teleport package is upgraded

set -eu

case "$1" in
configure)
vapopov marked this conversation as resolved.
Show resolved Hide resolved
# Define old paths and new base directory.
OLD_PATHS=(
"/usr/local/bin/teleport"
"/usr/local/bin/tsh"
"/usr/local/bin/tctl"
"/usr/local/bin/tbot"
)
NEW_BASE_DIR="/usr/local/teleport-system/bin"

echo "Cleaning up old files and creating symlinks where necessary..."

for FILE in "${OLD_PATHS[@]}"; do
BASENAME=$(basename "$FILE")
NEW_PATH="$NEW_BASE_DIR/$BASENAME"

if [ -e "$FILE" ] && [ ! -L "$FILE" ]; then
echo "Removing old binary at $FILE..."
vapopov marked this conversation as resolved.
Show resolved Hide resolved
rm -f "$FILE"
fi

if [ ! -e "$FILE" ] && [ ! -L "$FILE" ]; then
echo "Creating symlink at $FILE pointing to $NEW_PATH..."
ln -s "$NEW_PATH" "$FILE"
fi
done

echo "Post-upgrade cleanup and symlink creation completed."
;;
remove|deconfigure)
sclevine marked this conversation as resolved.
Show resolved Hide resolved
OLD_PATHS=(
"/usr/local/bin/teleport"
"/usr/local/bin/tsh"
"/usr/local/bin/tctl"
"/usr/local/bin/tbot"
)

echo "Removing symlinks from old paths..."

for FILE in "${OLD_PATHS[@]}"; do
if [ -L "$FILE" ]; then
vapopov marked this conversation as resolved.
Show resolved Hide resolved
echo "Removing symlink at $FILE..."
rm -f "$FILE"
fi
done
;;
esac

# skip reload and restart when systemd is disabled. This is only relevant when
# testing in a container.
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
11 changes: 0 additions & 11 deletions examples/systemd/post-upgrade

This file was deleted.

Loading