diff options
author | Oliver Poignant <oliver@poignant.se> | 2017-01-05 14:20:20 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2017-01-05 14:20:20 +0100 |
commit | 25e1d94b63b3905492a6a0fe9872b13db86033fc (patch) | |
tree | 6625841c5db122962834bed24da2ad543f932e6e | |
parent | 72e509fe66ea7f92bc34ff75b63bc8af76ad5195 (diff) | |
download | Git-Auto-Deploy-25e1d94b63b3905492a6a0fe9872b13db86033fc.zip Git-Auto-Deploy-25e1d94b63b3905492a6a0fe9872b13db86033fc.tar.gz Git-Auto-Deploy-25e1d94b63b3905492a6a0fe9872b13db86033fc.tar.bz2 |
Generate SSL cert on install
-rwxr-xr-x | platforms/debian/stdeb/git-auto-deploy.postinst | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/platforms/debian/stdeb/git-auto-deploy.postinst b/platforms/debian/stdeb/git-auto-deploy.postinst index b84d5fc..81b2b5c 100755 --- a/platforms/debian/stdeb/git-auto-deploy.postinst +++ b/platforms/debian/stdeb/git-auto-deploy.postinst @@ -18,6 +18,13 @@ adduser $GAD_UID $GAD_GID mkdir -p $HOME_DIR mkdir -p $HOME_DIR/.ssh touch $HOME_DIR/.ssh/known_hosts + +# Generate SSL certificate if openssl is installed +if [ -x "$(command -v openssl)" ]; then + openssl req -x509 -newkey rsa:4096 -keyout $HOME_DIR/key.pem -out $HOME_DIR/cert.pem -days 365 -nodes -subj "/C=/ST=/L=/O=Git Auto Deploy/OU=/CN=localhost" +fi + +# Set permissions on home dir chown -R $GAD_UID:$GAD_GID $HOME_DIR chmod -R 750 $HOME_DIR @@ -27,14 +34,18 @@ chown $GAD_UID:$GAD_GID /var/log/$NAME.log chmod 750 /var/log/$NAME.log # Create data directory -mkdir -p $DATA_DIR -chown -R $GAD_UID:$GAD_GID $DATA_DIR -chmod 750 $DATA_DIR +if [ ! -d "$DATA_DIR" ]; then + mkdir -p $DATA_DIR + chown -R $GAD_UID:$GAD_GID $DATA_DIR + chmod 750 $DATA_DIR +fi # Create pid file -mkdir $PID_DIR -touch $PID_FILE -chown $GAD_UID:$GAD_GID $PID_DIR $PID_FILE -chmod 750 $PID_FILE +if [ ! -d "$PID_DIR" ]; then + mkdir $PID_DIR + touch $PID_FILE + chown $GAD_UID:$GAD_GID $PID_DIR $PID_FILE + chmod 750 $PID_FILE +fi update-rc.d $NAME defaults |