Просмотр исходного кода

deleted old sitegen; fixed install script

tags/v2.0.0
Robin Thoni 8 лет назад
Родитель
Сommit
54fab214c8
2 измененных файлов: 1 добавлений и 85 удалений
  1. 1
    1
      install
  2. 0
    84
      sitegen.sh

+ 1
- 1
install Просмотреть файл

@@ -18,7 +18,7 @@ do
18 18
     do
19 19
         type=$(basename "${typedir}")
20 20
         hook=$(basename "${hookfile}")
21
-        sitegen --hook-"${type}"-enable "${hook}"
21
+        sitegen --hook-enable "${type}.${hook}"
22 22
     done
23 23
 done &&
24 24
 

+ 0
- 84
sitegen.sh Просмотреть файл

@@ -1,84 +0,0 @@
1
-#! /usr/bin/env sh
2
-
3
-apache_dir=/etc/apache2/sites-available/
4
-conf_dir=/etc/sitegen/
5
-site_dir=/var/
6
-
7
-hooks_dir=/etc/sitegen/hooks.d/
8
-hooks_dir_local=~/.sitegen/hooks.d/
9
-
10
-makeDir()
11
-{
12
-  mkdir -p "$1"
13
-  if [ $? -ne 0 ]
14
-  then
15
-    exit 4
16
-  fi
17
-}
18
-
19
-getPath()
20
-{
21
-  readlink -m "$1"
22
-}
23
-
24
-applyHooks()
25
-{
26
-  dir="$1"
27
-  if [ -d ${dir} ]
28
-  then
29
-    for file in $(find ${dir} | sort) ;
30
-    do
31
-      echo "Applying ${file}"
32
-      . "${file}"
33
-    done
34
-  else
35
-    echo "No hooks found in ${dir}"
36
-  fi
37
-}
38
-
39
-
40
-if [ $# -eq 0 ] || [ $# -gt 2 ] || [ "$1" = "--help" ]
41
-then
42
-  echo "Usage:" $(basename $0) "hostname [config=default]" >&2
43
-  exit 1
44
-fi
45
-
46
-host="$1"
47
-if [ $# -eq 2 ]
48
-then
49
-  conf="$2"
50
-else
51
-  conf="default"
52
-fi
53
-
54
-conf_conf=$(getPath "${conf_dir}/${conf}.conf")
55
-conf_include=$(getPath "${conf_dir}/${conf}.include")
56
-
57
-site_conf=$(getPath "${apache_dir}/${host}.conf")
58
-site_include=$(getPath "${apache_dir}/${host}.include")
59
-
60
-root_dir=$(getPath "${site_dir}/${host}")
61
-
62
-sed_host="s:%%HOST%%:${host}:g"
63
-sed_root="s:%%ROOT%%:${root_dir}:g"
64
-
65
-if [ ! -f "${conf_conf}" ] || [ ! -f "${conf_include}" ]
66
-then
67
-  echo "Configuration file ${conf_conf} and/or ${conf_include} error: No such file" >&2
68
-  exit 2
69
-fi
70
-
71
-if [ -f "${site_conf}" ]
72
-then
73
-  echo "Host already exists: ${site_conf}" >&2
74
-  exit 3
75
-fi
76
-
77
-makeDir "${root_dir}"
78
-makeDir "${apache_dir}"
79
-
80
-sed -e "${sed_host}" -e "${sed_root}" "${conf_conf}" > "${site_conf}"
81
-sed -e "${sed_host}" -e "${sed_root}" "${conf_include}" > "${site_include}"
82
-
83
-applyHooks ${hooks_dir}
84
-applyHooks ${hooks_dir_local}

Загрузка…
Отмена
Сохранить