-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·30 lines (26 loc) · 1007 Bytes
/
Copy pathdocker-entrypoint.sh
File metadata and controls
executable file
·30 lines (26 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
set -e
# Environment Variables:
# TERMINAL_HUB_USERNAME - Username for HTTP Basic Authentication (optional)
# TERMINAL_HUB_PASSWORD - Password for HTTP Basic Authentication (optional)
#
# If both TERMINAL_HUB_USERNAME and TERMINAL_HUB_PASSWORD are set,
# HTTP Basic Authentication will be enabled. Otherwise, the application
# runs in open mode with no authentication.
BACKUP_FILE="/tmp/home-backup.tar.gz"
MARKER_FILE="${HOME}/.terminal-hub-initialized"
USER="ubuntu"
# If HOME is empty or not initialized, restore from backup
if [ ! -f "${MARKER_FILE}" ]; then
echo "Initializing HOME directory from backup..."
if [ -f "${BACKUP_FILE}" ]; then
sudo tar -xzf "${BACKUP_FILE}" -C "${HOME}"
sudo chown -R $USER:$USER "${HOME}"
echo "HOME directory restored from backup."
else
echo "Warning: No backup file found at ${BACKUP_FILE}"
fi
touch "${MARKER_FILE}"
fi
# Execute the terminal-hub binary
exec runuser -u $USER -- terminal-hub "$@"