forked from mtusi2026/mtusi2026lab7
22 lines
530 B
Bash
22 lines
530 B
Bash
#!/bin/sh
|
|
|
|
set -eu
|
|
umask 077
|
|
|
|
case "${SERVICE:-}" in
|
|
api|worker) ;;
|
|
*) echo "SERVICE must be api or worker" >&2; exit 2 ;;
|
|
esac
|
|
|
|
source_dir="/source/$SERVICE"
|
|
target_dir="/identities/$SERVICE"
|
|
mkdir -p "$target_dir"
|
|
for file in role-id secret-id secret-id-accessor; do
|
|
cp "$source_dir/$file" "$target_dir/$file.next"
|
|
chown 10001:10001 "$target_dir/$file.next"
|
|
chmod 0600 "$target_dir/$file.next"
|
|
mv "$target_dir/$file.next" "$target_dir/$file"
|
|
done
|
|
chown 10001:10001 "$target_dir"
|
|
chmod 0700 "$target_dir"
|