17 lines
652 B
Bash
Executable File
17 lines
652 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|
|
|
VERSION="$1"
|
|
IMPORT_DIR="$2"
|
|
TARGET_DIR="$3"
|
|
|
|
[[ -f $IMPORT_DIR/.sshcommand ]] && mv "$IMPORT_DIR/.sshcommand" "$TARGET_DIR/.sshcommand"
|
|
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
|
mkdir -p "$TARGET_DIR/.ssh"
|
|
cat "$IMPORT_DIR/.ssh/authorized_keys" "$TARGET_DIR/.ssh/authorized_keys" | uniq > tmpfile && mv tmpfile "$TARGET_DIR/.ssh/authorized_keys"
|
|
chmod 0700 "$TARGET_DIR/.ssh"
|
|
chmod 0600 "$TARGET_DIR"/.ssh/*
|
|
fi
|
|
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv "$IMPORT_DIR/HOSTNAME" "$TARGET_DIR/HOSTNAME"
|
|
[[ -f $IMPORT_DIR/VHOST ]] && mv "$IMPORT_DIR/VHOST" "$TARGET_DIR/VHOST"
|