mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-22 01:27:29 +01:00
fix cleanup func
This commit is contained in:
parent
338c05bb56
commit
5cce0eeb5e
@ -38,6 +38,7 @@ KOJI_HUB_FQDN="$(hostname -f)"
|
||||
if [ ! -d $SCRIPT_DIR ] ; then mkdir -p $SCRIPT_DIR ; fi
|
||||
if [ ! -f $SCRIPT_DIR/koji-gencert.sh ] ; then
|
||||
curl $SILENT $SCRIPT_GIT/koji-gencert.sh > $SCRIPT_DIR/koji-gencert.sh
|
||||
chmod o+x $SCRIPT_DIR/koji-gencert.sh
|
||||
fi
|
||||
|
||||
# Add the new user into the database
|
||||
@ -55,12 +56,18 @@ if [[ ! -d $KOJI_PKI_DIR/bundle ]] ; then
|
||||
mkdir -p $KOJI_PKI_DIR/bundle
|
||||
fi
|
||||
|
||||
WORK_DIR=`mktemp -d $NEW_USER-XXXXXXXX`
|
||||
WORK_DIR=`mktemp -p /tmp -d $NEW_USER-XXXXXXXX`
|
||||
# check if tmp dir was created
|
||||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "Could not create temp dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# function to delete the temp directory
|
||||
function cleanup {
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
|
||||
# register the cleanup function to be called on the EXIT signal
|
||||
trap cleanup EXIT
|
||||
|
||||
@ -85,8 +92,3 @@ cp koji-"$NEW_USER"-bundle.tgz $KOJI_PKI_DIR/bundle/.
|
||||
popd
|
||||
|
||||
echo "The Koji CLI and Web key bundle for $NEW_USER is $KOJI_PKI_DIR/bundle/koij-$NEW_USER-bundle.tgz"
|
||||
|
||||
# function to delete the temp directory
|
||||
function cleanup {
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user