forked from alminium/alminium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall
executable file
·69 lines (60 loc) · 1.95 KB
/
uninstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
##########################################
# uninstaller for ALMinium
# 第1引数:データベースホスト名
# 第2引数:データベース管理者パスワード
##########################################
ALM_SRC_DIR=$(cd $(dirname $0);pwd)
ALM_ETC_DIR=${ALM_ETC_DIR:-/etc/opt/alminium}
ALM_VAR_DIR=${ALM_VAR_DIR:-/var/opt/alminium}
ALM_INSTALL_DIR=${ALM_INSTALL_DIR:-/opt/alminium}
ALM_DB_HOST=${1:-${ALM_DB_HOST}}
ALM_DB_HOST=${ALM_DB_HOST:-localhost}
ALM_DB_ROOT_PASS=${2:-${ALM_DB_ROOT_PASS}}
GEM=`which gem2.0`
GEM=${GEM:-gem}
# move to sources directry
cd ${ALM_SRC_DIR}
# include functions
source inst-script/functions
# start uninstall
echo "ALMiniumをアンインストールします。"
echo ""
# remove db
echo -n "データベース(全てのRedmineの情報)とリポジトリを削除しますか?(y/N)"
read YN
if [ "$YN" = "y" ]; then
DBCMD="mysql `db_option_root`"
${DBCMD} alminium -e "REVOKE ALL ON alminium.* FROM alminium@%" \
2>/dev/null
${DBCMD} alminium -e "REVOKE ALL ON alminium.* FROM alminium@localhost" \
2>/dev/null
${DBCMD} alminium -e "DELETE FROM mysql.user WHERE User LIKE 'alminium'"
${DBCMD} alminium -e "FLUSH PRIVILEGES"
${DBCMD} alminium -e "DROP DATABASE alminium"
rm -fr ${ALM_INSTALL_DIR}/* ${ALM_INSTALL_DIR}/.[^.]* ${ALM_VAR_DIR}/*
fi
# remove apache2 config
echo ""
echo -n "Apacheの設定を削除しますか?(y/N)"
read YN
if [ "$YN" = "y" ]; then
rm -fr /etc/httpd/conf.d/{alminium}.conf
rm -fr /etc/apache2/conf.d/{alminium}.conf
rm -fr /etc/apache2/sites-{available,enabled}/alminium.conf
rm -fr $ALM_ETC_DIR/*
fi
# uninstall jenkins
echo ""
echo -n "Jenkinsとその設定を削除しますか?(y/N)"
read YN
if [ "$YN" = "y" ]; then
source jenkins/setup/uninstall.sh
fi
# remove cache
echo ""
echo -n "キャッシュされたファイルを削除しますか?(y/N)"
read YN
if [ "$YN" = "y" ]; then
rm -fr cache *.installed
fi