aboutsummaryrefslogtreecommitdiff
path: root/src/sshd
diff options
context:
space:
mode:
Diffstat (limited to 'src/sshd')
-rw-r--r--src/sshd/devcontainer-feature.json2
-rwxr-xr-xsrc/sshd/install.sh15
2 files changed, 13 insertions, 4 deletions
diff --git a/src/sshd/devcontainer-feature.json b/src/sshd/devcontainer-feature.json
index 518c35b..24c4ba6 100644
--- a/src/sshd/devcontainer-feature.json
+++ b/src/sshd/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "sshd",
- "version": "1.0.3",
+ "version": "1.0.4",
"name": "SSH server",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/sshd",
"description": "Adds a SSH server into a container so that you can use an external terminal, sftp, or SSHFS to interact with it.",
diff --git a/src/sshd/install.sh b/src/sshd/install.sh
index 25b8859..a93b927 100755
--- a/src/sshd/install.sh
+++ b/src/sshd/install.sh
@@ -17,6 +17,9 @@ FIX_ENVIRONMENT=${FIX_ENVIRONMENT:-"true"}
set -e
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
@@ -41,8 +44,10 @@ fi
apt_get_update()
{
- echo "Running apt-get update..."
- apt-get update -y
+ if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+ echo "Running apt-get update..."
+ apt-get update -y
+ fi
}
# Checks if packages are installed and installs them if not
@@ -166,4 +171,8 @@ echo -e "Done!\n\n- Port: ${SSHD_PORT}\n- User: ${USERNAME}"
if [ "${EMIT_PASSWORD}" = "true" ]; then
echo "- Password: ${NEW_PASSWORD}"
fi
-echo -e "\nForward port ${SSHD_PORT} to your local machine and run:\n\n ssh -p ${SSHD_PORT} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null ${USERNAME}@localhost\n" \ No newline at end of file
+
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
+echo -e "\nForward port ${SSHD_PORT} to your local machine and run:\n\n ssh -p ${SSHD_PORT} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null ${USERNAME}@localhost\n"