own-pki/bin/uninstall.sh
Gilles Mouchet 11b848c3f2 1.0.0
2026-04-30 06:48:53 +02:00

68 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
#############################################################
# Script name: uninstall.sh
# Author: Gilles Mouchet (gilles.mouchet@gmail.com
# Version: 1.0.0
# Description: Uninstall own pki
# License: GNU GPL v3
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Changelog
# [1.0.0] - 2026-04-30
# Added:
# - uninstall script
# Project initialization:
# - initialization by gilles.mouchet@gmail.com
#
############################################################
version=1.0.0
############################################################
# MAIN
############################################################
main(){
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
# To ensure that users are prompted to confirm with a yes or no.
ASSUME_YES=0
# read library
source "$ROOT_DIR/lib/stdlib.sh"
# init config
init_default
init_env
# set color
set_color
# check if script is run with sudo
check_sudo
# message
msg_info "***********************************************"
msg_info " You are going to uninstall the own PKI toolkit."
msg_info " Only the scripts will be uninstalled."
msg_error " The folders below will NOT BE DELETED."
msg_warn " - $KEY_CA_PATH"
msg_warn " - $CRT_CA_PATH"
msg_warn " - $CERTS_PATH"
msg_info "***********************************************"
yes_no "Are you sure"
echo -e -n "Delete $CONF_PATH: "
rm -rf $CONF_PATH
check_rc $?
echo -e -n "Delete $ROOT_DIR: "
rm -rf $ROOT_DIR
check_rc $?
}
main "$@"