瀏覽代碼

Removed unused deploy command

Bob Mottram 9 年之前
父節點
當前提交
16b5a77cb4
共有 1 個檔案被更改,包括 0 行新增165 行删除
  1. 0
    165
      src/freedombone-deploy

+ 0
- 165
src/freedombone-deploy 查看文件

@@ -1,165 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# An initialisation script which can be run after installing
12
-# a disk image
13
-#
14
-# License
15
-# =======
16
-#
17
-# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
18
-#
19
-# This program is free software: you can redistribute it and/or modify
20
-# it under the terms of the GNU General Public License as published by
21
-# the Free Software Foundation, either version 3 of the License, or
22
-# (at your option) any later version.
23
-#
24
-# This program is distributed in the hope that it will be useful,
25
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
-# GNU General Public License for more details.
28
-#
29
-# You should have received a copy of the GNU General Public License
30
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
31
-
32
-PROJECT_NAME='freedombone'
33
-
34
-export TEXTDOMAIN=${PROJECT_NAME}-deploy
35
-export TEXTDOMAINDIR="/usr/share/locale"
36
-
37
-# Default username for disk images
38
-DEFAULT_IMAGE_USERNAME='freedom'
39
-
40
-MY_NAME='fbn'
41
-MY_USERNAME=$MY_NAME
42
-MY_EMAIL_ADDRESS=$MY_USERNAME@$(hostname)
43
-
44
-# various passwords
45
-CJDNS_PASSWORD=
46
-MARIADB_PASSWORD=
47
-MICROBLOG_ADMIN_PASSWORD=
48
-GIT_ADMIN_PASSWORD=
49
-HUBZILLA_ADMIN_PASSWORD=
50
-OWNCLOUD_ADMIN_PASSWORD=
51
-WIKI_ADMIN_PASSWORD=
52
-FULLBLOG_ADMIN_PASSWORD=
53
-VOIP_SERVER_PASSWORD=
54
-SIP_SERVER_PASSWORD=
55
-
56
-function create_backup_gpg_key {
57
-    echo 'Key-Type: 1' > /home/$MY_USERNAME/gpg-genkey.conf
58
-    echo 'Key-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
59
-    echo 'Subkey-Type: 1' >> /home/$MY_USERNAME/gpg-genkey.conf
60
-    echo 'Subkey-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf
61
-    echo "Name-Real:  $MY_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf
62
-    echo "Name-Email: $MY_EMAIL_ADDRESS" >> /home/$MY_USERNAME/gpg-genkey.conf
63
-    echo "Name-Comment: backup key" >> /home/$MY_USERNAME/gpg-genkey.conf
64
-    echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
65
-    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
66
-    su -c "gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
67
-    shred -zu /home/$MY_USERNAME/gpg-genkey.conf
68
-    BACKUP_KEY_EXISTS=$(su -c "gpg --list-keys \"$MY_NAME (backup key)\"" - $MY_USERNAME)
69
-    if [ ! "$?" = "0" ]; then
70
-        echo 'Backup key could not be created'
71
-        exit 43382
72
-    fi
73
-
74
-	MY_BACKUP_KEY_ID=$(su -c "gpg --list-keys \"$MY_NAME (backup key)\" | grep 'pub '" - $MY_USERNAME | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
75
-	echo "Backup key: $MY_BACKUP_KEY_ID"
76
-	MY_BACKUP_KEY=/home/$MY_USERNAME/backup_key
77
-	su -c "gpg --output ${MY_BACKUP_KEY}_public.asc --armor --export $MY_BACKUP_KEY_ID" - $MY_USERNAME
78
-	su -c "gpg --output ${MY_BACKUP_KEY}_private.asc --armor --export-secret-key $MY_BACKUP_KEY_ID" - $MY_USERNAME
79
-	if [ ! -f ${MY_BACKUP_KEY}_public.asc ]; then
80
-		echo 'Public backup key could not be exported'
81
-		exit 36829
82
-	fi
83
-	if [ ! -f ${MY_BACKUP_KEY}_private.asc ]; then
84
-		echo 'Private backup key could not be exported'
85
-		exit 29235
86
-	fi
87
-
88
-	# import backup key to root user
89
-	gpg --import --import ${MY_BACKUP_KEY}_public.asc
90
-	gpg --allow-secret-key-import --import ${MY_BACKUP_KEY}_private.asc
91
-
92
-	shred -zu ${MY_BACKUP_KEY}_public.asc
93
-	shred -zu ${MY_BACKUP_KEY}_private.asc
94
-	echo 'New backup gpg key created'
95
-}
96
-
97
-function regenerate_ssh_host_keys {
98
-    rm -f /etc/ssh/ssh_host_*
99
-    dpkg-reconfigure openssh-server
100
-    echo 'ssh host keys regenerated'
101
-    # remove small moduli
102
-    awk '$5 > 2000' /etc/ssh/moduli > ~/moduli
103
-    mv ~/moduli /etc/ssh/moduli
104
-    echo 'ssh small moduli removed'
105
-    systemctl restart ssh
106
-}
107
-
108
-function get_passwords_from_readme {
109
-	readme_file=$1
110
-	if [ ! -f $readme_file ]; then
111
-		return
112
-	fi
113
-
114
-    if grep -q "cjdns password" $readme_file; then
115
-        if [ ! $CJDNS_PASSWORD ]; then
116
-            CJDNS_PASSWORD=$(cat $readme_file | grep "cjdns password" | awk -F ':' '{print $2}' | sed 's/^ *//')
117
-        fi
118
-    fi
119
-    if grep -q "MariaDB password" $readme_file; then
120
-        if [ -f $DATABASE_PASSWORD_FILE ]; then
121
-            MARIADB_PASSWORD=$(cat $DATABASE_PASSWORD_FILE)
122
-        else
123
-            MARIADB_PASSWORD=$(cat $readme_file | grep "MariaDB password" | awk -F ':' '{print $2}' | sed 's/^ *//')
124
-            echo "$MARIADB_PASSWORD" > $DATABASE_PASSWORD_FILE
125
-            chmod 600 $DATABASE_PASSWORD_FILE
126
-        fi
127
-    fi
128
-    if grep -q "MariaDB gnusocial admin password" $readme_file; then
129
-        MICROBLOG_ADMIN_PASSWORD=$(cat $readme_file | grep "MariaDB gnusocial admin password" | awk -F ':' '{print $2}' | sed 's/^ *//')
130
-    fi
131
-    if grep -q "Gogs admin user password" $readme_file; then
132
-        GIT_ADMIN_PASSWORD=$(cat $readme_file | grep "Gogs admin user password" | awk -F ':' '{print $2}' | sed 's/^ *//')
133
-    fi
134
-    if grep -q "MariaDB Hubzilla admin password" $readme_file; then
135
-        HUBZILLA_ADMIN_PASSWORD=$(cat $readme_file | grep "MariaDB Hubzilla admin password" | awk -F ':' '{print $2}' | sed 's/^ *//')
136
-    fi
137
-    if grep -q "Owncloud database password" $readme_file; then
138
-        OWNCLOUD_ADMIN_PASSWORD=$(cat $readme_file | grep "Owncloud database password" | awk -F ':' '{print $2}' | sed 's/^ *//')
139
-    fi
140
-    if grep -q "Wiki password" $readme_file; then
141
-        WIKI_ADMIN_PASSWORD=$(cat $readme_file | grep "Wiki password:" | awk -F ':' '{print $2}' | sed 's/^ *//')
142
-    fi
143
-}
144
-
145
-function set_admin_user {
146
-    sed -i "s|Admin user:.*|Admin user:$MY_USERNAME|g" $COMPLETION_FILE
147
-}
148
-
149
-if [ ! -d /home/$DEFAULT_IMAGE_USERNAME ]; then
150
-	echo "User $DEFAULT_IMAGE_USERNAME not found"
151
-	exit 52372
152
-fi
153
-
154
-if [ -d /home/$MY_USERNAME ]; then
155
-	echo "User $MY_USERNAME already exists"
156
-	exit 73538
157
-fi
158
-
159
-get_passwords_from_readme /home/$DEFAULT_IMAGE_USERNAME/README
160
-#${PROJECT_NAME}-adduser $MY_USERNAME > ~/setup.txt
161
-#set_admin_user
162
-#create_backup_gpg_key
163
-#regenerate_ssh_host_keys
164
-
165
-exit 0