mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-05-27 19:13:04 +02:00
fix: entrypoint init
This commit is contained in:
parent
f4479bb2f8
commit
b5b4f1a766
|
@ -14,10 +14,12 @@ init_ssh_server() {
|
|||
fi
|
||||
}
|
||||
|
||||
create_ssh_directory() {
|
||||
check_ssh_directory() {
|
||||
if [ ! -d "$SSH_DIR" ]; then
|
||||
echo "The .ssh directory does not exist, creating..."
|
||||
mkdir -p "$SSH_DIR"
|
||||
echo "The .ssh directory does not exist, you need to mount it as docker volume."
|
||||
exit 1
|
||||
else
|
||||
chown borgwarehouse:borgwarehouse "$SSH_DIR"
|
||||
chmod 700 "$SSH_DIR"
|
||||
fi
|
||||
}
|
||||
|
@ -26,20 +28,22 @@ create_authorized_keys_file() {
|
|||
if [ ! -f "$AUTHORIZED_KEYS_FILE" ]; then
|
||||
echo "The authorized_keys file does not exist, creating..."
|
||||
touch "$AUTHORIZED_KEYS_FILE"
|
||||
chmod 600 "$AUTHORIZED_KEYS_FILE"
|
||||
fi
|
||||
chmod 600 "$AUTHORIZED_KEYS_FILE"
|
||||
}
|
||||
|
||||
create_repos_directory() {
|
||||
check_repos_directory() {
|
||||
if [ ! -d "$REPOS_DIR" ]; then
|
||||
echo "The repos directory does not exist, creating..."
|
||||
mkdir -p "$REPOS_DIR"
|
||||
echo "The repos directory does not exist, you need to mount it as docker volume."
|
||||
exit 2
|
||||
fi
|
||||
chown borgwarehouse:borgwarehouse "$REPOS_DIR"
|
||||
chmod 700 "$REPOS_DIR"
|
||||
}
|
||||
|
||||
init_ssh_server
|
||||
create_ssh_directory
|
||||
check_ssh_directory
|
||||
create_authorized_keys_file
|
||||
create_repos_directory
|
||||
check_repos_directory
|
||||
|
||||
exec "$@"
|
Loading…
Reference in a new issue