Browse Source

Deprecate mirrors

Bob Mottram 7 years ago
parent
commit
9aebefe0aa

+ 0
- 5
src/freedombone-addcert View File

59
 INSTALL_DIR=/root/build
59
 INSTALL_DIR=/root/build
60
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
60
 LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
61
 MY_EMAIL_ADDRESS=
61
 MY_EMAIL_ADDRESS=
62
-FRIENDS_MIRRORS_SERVER=
63
-FRIENDS_MIRRORS_PASSWORD=
64
-FRIENDS_MIRRORS_SSH_PORT=
65
-MY_MIRRORS_PASSWORD=
66
 
62
 
67
 function show_help {
63
 function show_help {
68
     echo ''
64
     echo ''
360
     fi
356
     fi
361
 }
357
 }
362
 
358
 
363
-read_repo_servers
364
 create_cert
359
 create_cert
365
 generate_dh_params
360
 generate_dh_params
366
 restart_web_server
361
 restart_web_server

+ 2
- 2
src/freedombone-base-email View File

1159
     echo '#!/bin/bash' > /usr/bin/filterspam
1159
     echo '#!/bin/bash' > /usr/bin/filterspam
1160
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
1160
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
1161
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
1161
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
1162
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterspam
1162
+    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterspam
1163
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
1163
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
1164
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
1164
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
1165
     echo '           exit' >> /usr/bin/filterspam
1165
     echo '           exit' >> /usr/bin/filterspam
1181
     echo '#!/bin/bash' > /usr/bin/filterham
1181
     echo '#!/bin/bash' > /usr/bin/filterham
1182
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
1182
     echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
1183
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
1183
     echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
1184
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterham
1184
+    echo '    if [[ $USERNAME != "git" && $USERNAME != "go" && $USERNAME != "gogs" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then' >> /usr/bin/filterham
1185
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
1185
     echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
1186
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
1186
     echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
1187
     echo '            exit' >> /usr/bin/filterham
1187
     echo '            exit' >> /usr/bin/filterham

+ 1
- 52
src/freedombone-config View File

97
 SELECTED_USERNAME=
97
 SELECTED_USERNAME=
98
 SOCIALINSTANCE=
98
 SOCIALINSTANCE=
99
 
99
 
100
-# Mirrors settings
101
-FRIENDS_MIRRORS_SERVER=
102
-FRIENDS_MIRRORS_SSH_PORT=2222
103
-FRIENDS_MIRRORS_PASSWORD=
104
-MY_MIRRORS_PASSWORD=
105
-
106
 VALID_CODE=
100
 VALID_CODE=
107
 
101
 
108
 PROJECT_INSTALL_DIR=/usr/local/bin
102
 PROJECT_INSTALL_DIR=/usr/local/bin
861
     shift
855
     shift
862
 done
856
 done
863
 
857
 
864
-function set_main_repo {
865
-    return
866
-
867
-    data=$(tempfile 2>/dev/null)
868
-    trap "rm -f $data" 0 1 2 5 15
869
-    dialog --backtitle $"Freedombone Control Panel" \
870
-           --title $"Main Repository (Mirrors)" \
871
-           --form $"If you don't know what this means then just select Ok.\n\nIf you don't wish to use the default repositories they can be obtained from mirrored repos on another ${PROJECT_NAME} system.\n\nThe repositories are for applications which are not yet packaged for Debian." 18 65 4 \
872
-           $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 18 40 18 \
873
-           $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 18 10 10000 \
874
-           $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 18 40 10000 \
875
-           2> $data
876
-    sel=$?
877
-    case $sel in
878
-        1) return;;
879
-        255) return;;
880
-    esac
881
-    new_mirrors_url=$(cat $data | sed -n 1p)
882
-    new_mirrors_ssh_port=$(cat $data | sed -n 2p)
883
-    new_mirrors_password=$(cat $data | sed -n 3p)
884
-
885
-    if [ ${#new_mirrors_url} -lt 2 ]; then
886
-        return
887
-    fi
888
-    if [ ${#new_mirrors_ssh_port} -lt 1 ]; then
889
-        return
890
-    fi
891
-    if [ ${#new_mirrors_password} -lt 10 ]; then
892
-        dialog --title $"Main Repository" \
893
-               --msgbox $'Mirrors password was too short. Should be at least 10 characters.' 6 40
894
-        return
895
-    fi
896
-
897
-    if [[ $new_mirrors_url == *"."* ]]; then
898
-        FRIENDS_MIRRORS_SERVER=$new_mirrors_url
899
-        FRIENDS_MIRRORS_SSH_PORT=$new_mirrors_ssh_port
900
-        FRIENDS_MIRRORS_PASSWORD=$new_mirrors_password
901
-
902
-        dialog --title $"Main Repository" \
903
-               --msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
904
-    fi
905
-    save_configuration_values
906
-}
907
-
908
 function interactive_select_language {
858
 function interactive_select_language {
909
     data=$(tempfile 2>/dev/null)
859
     data=$(tempfile 2>/dev/null)
910
     trap "rm -f $data" 0 1 2 5 15
860
     trap "rm -f $data" 0 1 2 5 15
1074
 
1024
 
1075
     users_array=($(ls /home))
1025
     users_array=($(ls /home))
1076
 
1026
 
1077
-    delete=(mirrors git)
1027
+    delete=(git)
1078
     for del in ${delete[@]}
1028
     for del in ${delete[@]}
1079
     do
1029
     do
1080
         users_array=(${users_array[@]/$del})
1030
         users_array=(${users_array[@]/$del})
1125
     dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50
1075
     dialog --title $"Freedombone" --msgbox "$INITIAL_MESSAGE" 15 50
1126
 
1076
 
1127
     #choose_system_variant
1077
     #choose_system_variant
1128
-    #set_main_repo
1129
     choose_username
1078
     choose_username
1130
     choose_full_name
1079
     choose_full_name
1131
     choose_social_key_management
1080
     choose_social_key_management

+ 2
- 76
src/freedombone-controlpanel View File

128
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
128
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
129
 fi
129
 fi
130
 
130
 
131
-# Mirrors settings
132
-FRIENDS_MIRRORS_SERVER=
133
-FRIENDS_MIRRORS_SSH_PORT=2222
134
-FRIENDS_MIRRORS_PASSWORD=
135
-MY_MIRRORS_PASSWORD=
136
-
137
 function any_key {
131
 function any_key {
138
     echo ' '
132
     echo ' '
139
     read -n1 -r -p $"Press any key to continue..." key
133
     read -n1 -r -p $"Press any key to continue..." key
153
 
147
 
154
     users_array=($(ls /home))
148
     users_array=($(ls /home))
155
 
149
 
156
-    delete=(mirrors git)
150
+    delete=(git)
157
     for del in ${delete[@]}
151
     for del in ${delete[@]}
158
     do
152
     do
159
         users_array=(${users_array[@]/$del})
153
         users_array=(${users_array[@]/$del})
290
     any_key
284
     any_key
291
 }
285
 }
292
 
286
 
293
-function set_main_repo {
294
-    return
295
-
296
-    data=$(tempfile 2>/dev/null)
297
-    trap "rm -f $data" 0 1 2 5 15
298
-    dialog --backtitle $"Freedombone Control Panel" \
299
-           --title $"Main Repository (Mirrors)" \
300
-           --form $"If you do not wish to use the default repositories they can be obtained from mirrors on another ${PROJECT_NAME} server." 14 60 3 \
301
-           $"URL:" 1 1 "$FRIENDS_MIRRORS_SERVER" 1 14 40 15 \
302
-           $"SSH Port:" 2 1 "$FRIENDS_MIRRORS_SSH_PORT" 2 14 40 10000 \
303
-           $"Password:" 3 1 "$FRIENDS_MIRRORS_PASSWORD" 3 14 40 10000 \
304
-           2> $data
305
-    sel=$?
306
-    case $sel in
307
-        1) return;;
308
-        255) return;;
309
-    esac
310
-    new_mirrors_url=$(cat $data | sed -n 1p)
311
-    new_mirrors_ssh_port=$(cat $data | sed -n 2p)
312
-    new_mirrors_password=$(cat $data | sed -n 3p)
313
-
314
-    if [ ${#new_mirrors_url} -lt 2 ]; then
315
-        return
316
-    fi
317
-    if [ ${#new_mirrors_ssh_port} -lt 1 ]; then
318
-        return
319
-    fi
320
-    if [ ${#new_mirrors_password} -lt 10 ]; then
321
-        dialog --title $"Main Repository" \
322
-               --msgbox $'Mirrors password was too short. Should be at least 10 characters.' 6 40
323
-        return
324
-    fi
325
-
326
-    if [[ $new_mirrors_url == *"."* ]]; then
327
-        FRIENDS_MIRRORS_SERVER=$new_mirrors_url
328
-        FRIENDS_MIRRORS_SSH_PORT=$new_mirrors_ssh_port
329
-        FRIENDS_MIRRORS_PASSWORD=$new_mirrors_password
330
-
331
-        write_config_param "FRIENDS_MIRRORS_SERVER" "$FRIENDS_MIRRORS_SERVER"
332
-        write_config_param "FRIENDS_MIRRORS_SSH_PORT" "$FRIENDS_MIRRORS_SSH_PORT"
333
-        write_config_param "FRIENDS_MIRRORS_PASSWORD" "$FRIENDS_MIRRORS_PASSWORD"
334
-
335
-        # re-read the repos
336
-        read_repo_servers
337
-
338
-        dialog --title $"Main Repository" \
339
-               --msgbox $"Main repository set to $FRIENDS_MIRRORS_SERVER" 6 60
340
-    fi
341
-}
342
-
343
 function add_user {
287
 function add_user {
344
     data=$(tempfile 2>/dev/null)
288
     data=$(tempfile 2>/dev/null)
345
     trap "rm -f $data" 0 1 2 5 15
289
     trap "rm -f $data" 0 1 2 5 15
516
     echo ''
460
     echo ''
517
 }
461
 }
518
 
462
 
519
-function show_mirrors_password {
520
-    return
521
-
522
-    if [ ! /home/mirrors ]; then
523
-        return
524
-    fi
525
-    read_config_param "MY_MIRRORS_PASSWORD"
526
-    echo 'Local Mirrors'
527
-    echo '============='
528
-    echo ''
529
-    echo -n "URL:      "
530
-    echo "$(cat ${COMPLETION_FILE} | grep 'ssh onion domain' | awk -F ':' '{print $2}')    SSH Port: $SSH_PORT"
531
-    echo "Password: $MY_MIRRORS_PASSWORD"
532
-    echo ''
533
-}
534
-
535
 function show_tahoelafs {
463
 function show_tahoelafs {
536
     if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
464
     if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
537
         return
465
         return
621
     show_ssh_public_key
549
     show_ssh_public_key
622
     show_domains
550
     show_domains
623
     show_tahoelafs
551
     show_tahoelafs
624
-    #show_mirrors_password
625
     show_users
552
     show_users
626
     any_key
553
     any_key
627
 }
554
 }
631
 
558
 
632
     users_array=($(ls /home))
559
     users_array=($(ls /home))
633
 
560
 
634
-    delete=(mirrors git)
561
+    delete=(git)
635
     for del in ${delete[@]}
562
     for del in ${delete[@]}
636
     do
563
     do
637
         users_array=(${users_array[@]/$del})
564
         users_array=(${users_array[@]/$del})
2180
 fi
2107
 fi
2181
 
2108
 
2182
 ADMIN_USER=$(get_completion_param "Admin user")
2109
 ADMIN_USER=$(get_completion_param "Admin user")
2183
-read_repo_servers
2184
 menu_top_level
2110
 menu_top_level
2185
 clear
2111
 clear
2186
 cat /etc/motd
2112
 cat /etc/motd

+ 0
- 5
src/freedombone-mesh-install View File

47
 rootdir=''
47
 rootdir=''
48
 FN=
48
 FN=
49
 CHROOT_PREFIX=''
49
 CHROOT_PREFIX=''
50
-FRIENDS_MIRRORS_SERVER=
51
 
50
 
52
 # To avoid confusions these are obtained from the main project file
51
 # To avoid confusions these are obtained from the main project file
53
 TOXID_REPO=
52
 TOXID_REPO=
273
         shift
272
         shift
274
         WIFI_INTERFACE="$1"
273
         WIFI_INTERFACE="$1"
275
         ;;
274
         ;;
276
-    -m|--mirror)
277
-        shift
278
-        FRIENDS_MIRRORS_SERVER="$1"
279
-        ;;
280
     --remove)
275
     --remove)
281
         shift
276
         shift
282
         REMOVE="$1"
277
         REMOVE="$1"

+ 0
- 288
src/freedombone-mirrors View File

1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# Mirror git repos which the project depends on
12
-#
13
-# License
14
-# =======
15
-#
16
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
17
-#
18
-# This program is free software: you can redistribute it and/or modify
19
-# it under the terms of the GNU Affero General Public License as published by
20
-# the Free Software Foundation, either version 3 of the License, or
21
-# (at your option) any later version.
22
-#
23
-# This program is distributed in the hope that it will be useful,
24
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
-# GNU Affero General Public License for more details.
27
-#
28
-# You should have received a copy of the GNU Affero General Public License
29
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
-
31
-PROJECT_NAME='freedombone'
32
-
33
-export TEXTDOMAIN=${PROJECT_NAME}-mirrors
34
-export TEXTDOMAINDIR="/usr/share/locale"
35
-
36
-# Minimum number of characters in a password
37
-MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords | grep 'MINIMUM_PASSWORD_LENGTH=' | head -n 1 | awk -F '=' '{print $2}')
38
-
39
-CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
40
-
41
-# used to mirror a single application
42
-SYNC_SINGLE_APP=
43
-
44
-# if this is blank then just use the default repos
45
-FRIENDS_MIRRORS_SERVER=
46
-UTILS_REPOS=
47
-INSTALLED_APPS_REPOS=
48
-MY_MIRRORS_PASSWORD=
49
-FRIENDS_MIRRORS_PASSWORD=
50
-NEW_MIRRORS='no'
51
-FRIENDS_MIRRORS_SSH_PORT=2222
52
-
53
-MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME}
54
-if [ ! -f $MAIN_COMMAND ]; then
55
-    MAIN_COMMAND=/usr/bin/${PROJECT_NAME}
56
-fi
57
-
58
-# local repos for utils
59
-UTILS_REPOS=($(cat ${MAIN_COMMAND} /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
60
-
61
-UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
62
-for f in $UTILS_FILES
63
-do
64
-    source $f
65
-done
66
-
67
-# obtain the mirrors password if it exists
68
-read_config_param MY_MIRRORS_PASSWORD
69
-read_config_param FRIENDS_MIRRORS_SERVER
70
-read_config_param FRIENDS_MIRRORS_PASSWORD
71
-read_config_param FRIENDS_MIRRORS_SSH_PORT
72
-
73
-function show_help {
74
-    echo ''
75
-    echo $"${PROJECT_NAME}-mirrors --sync [domain/url] -p [password]"
76
-    echo ''
77
-    echo $'Creates or syncs with a set of git repositories'
78
-    echo ''
79
-    echo $'     --help                   Show help'
80
-    echo $'  -n|--new [yes|no]           Start a new mirrors'
81
-    echo $"  -p|--password [password]    Friend's mirrors user password"
82
-    echo $"  -m|--mypassword [password]  Local mirrors user password"
83
-    echo $"     --port [number]          Friend's server ssh port number"
84
-    echo $"  -s|--sync [domain]          Friend's server domain to sync with"
85
-    echo ''
86
-    exit 0
87
-}
88
-
89
-function create_mirrors_user {
90
-    if [ -d /home/mirrors ]; then
91
-        return
92
-    fi
93
-
94
-    create_password=1
95
-    if [ ${#MY_MIRRORS_PASSWORD} -ge ${MINIMUM_PASSWORD_LENGTH} ]; then
96
-        create_password=
97
-    fi
98
-
99
-    if [ $create_password ]; then
100
-        MY_MIRRORS_PASSWORD=$(openssl rand -base64 64 | tr -dc A-Za-z0-9 | head -c 18)
101
-    fi
102
-
103
-    chmod 600 /etc/shadow
104
-    chmod 600 /etc/gshadow
105
-    useradd -m -p "$MY_MIRRORS_PASSWORD" -s /bin/bash mirrors
106
-    chmod 0000 /etc/shadow
107
-    chmod 0000 /etc/gshadow
108
-
109
-    # remove any existing user files
110
-    rm -rf /home/mirrors/*
111
-
112
-    # store the mirrors password
113
-    write_config_param "MY_MIRRORS_PASSWORD" "${MY_MIRRORS_PASSWORD}"
114
-}
115
-
116
-function enable_mirrors_via_onion {
117
-    if ! grep -q 'Host *.onion' /home/mirrors/.ssh/config; then
118
-        if [ ! -d /home/mirrors/.ssh ]; then
119
-            mkdir /home/mirrors/.ssh
120
-        fi
121
-        echo 'Host *.onion' >> /home/mirrors/.ssh/config
122
-        echo 'ProxyCommand connect -R remote -5 -S 127.0.0.1:9050 %h %p' >> /home/mirrors/.ssh/config
123
-        chown mirrors:mirrors /home/mirrors/.ssh
124
-        chown mirrors:mirrors /home/mirrors/.ssh/config
125
-    fi
126
-}
127
-
128
-function update_installed_single_repo {
129
-    # only deal with a single app
130
-    filename=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${SYNC_SINGLE_APP}
131
-    if [ ! -f $filename ]; then
132
-        echo $"The app $SYNC_SINGLE_APP was not found"
133
-        exit 36822
134
-    fi
135
-    APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
136
-    for line in "${APP_REPOS[@]}"
137
-    do
138
-        INSTALLED_APPS_REPOS+=("${line}")
139
-    done
140
-}
141
-
142
-function update_installed_apps_repos {
143
-    INSTALLED_APPS_REPOS=()
144
-
145
-    function_check app_is_installed
146
-
147
-    if [ $SYNC_SINGLE_APP ]; then
148
-        update_installed_single_repo
149
-        return
150
-    fi
151
-
152
-    # all apps currently installed
153
-    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
154
-
155
-    # for all the app scripts
156
-    for filename in $FILES
157
-    do
158
-        app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
159
-        if [[ "$(app_is_installed ${app_name})" == "1" ]]; then
160
-            APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
161
-            for line in "${APP_REPOS[@]}"
162
-            do
163
-                INSTALLED_APPS_REPOS+=("${line}")
164
-            done
165
-        fi
166
-    done
167
-}
168
-
169
-function update_repos_from_friend_base {
170
-    syncrepos=${1}
171
-    new_repos=()
172
-    for line in $syncrepos
173
-    do
174
-        repo_name=$(echo "$line" | awk -F '=' '{print $1}')
175
-        mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
176
-        friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
177
-        new_line="${repo_name}=\"${friends_repo_url}\""
178
-        new_repos+=($new_line)
179
-    done
180
-}
181
-
182
-function update_repos_from_friend {
183
-    if [ ! $FRIENDS_MIRRORS_SERVER ]; then
184
-       return
185
-    fi
186
-    if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then
187
-        return
188
-    fi
189
-
190
-    update_repos_from_friend_base "${UTILS_REPOS[@]}"
191
-    UTILS_REPOS=("${new_repos[@]}")
192
-
193
-    update_repos_from_friend_base "${INSTALLED_APPS_REPOS[@]}"
194
-    INSTALLED_APPS_REPOS=("${new_repos[@]}")
195
-}
196
-
197
-function sync_mirrors_base {
198
-    syncrepos=${1}
199
-    for line in $syncrepos
200
-    do
201
-        repo_name=$(echo "$line" | awk -F '=' '{print $1}')
202
-        repo_url=$(echo "$line" | awk -F '=' '{print $2}'  | awk -F '"' '{print $2}')
203
-        mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
204
-        if [[ ${mirrors_name} != 'debian' && ${mirrors_name} != 'cmake' ]]; then
205
-            if [[ $NEW_MIRRORS == 'yes' ]]; then
206
-                if [ -d /home/mirrors/${mirrors_name} ]; then
207
-                    rm -rf /home/mirrors/${mirrors_name}
208
-                fi
209
-            fi
210
-            if [ ! -d /home/mirrors/${mirrors_name} ]; then
211
-                if [[ ${repo_url} != 'ssh:'* ]]; then
212
-                    git clone --mirror ${repo_url} /home/mirrors/${mirrors_name}
213
-                else
214
-                    sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git clone --mirror ${repo_url} /home/mirrors/${mirrors_name}
215
-                fi
216
-                if [ ! -d /home/mirrors/${mirrors_name} ]; then
217
-                    echo $"WARNING: failed to mirror repo ${repo_url}"
218
-                fi
219
-            else
220
-                cd /home/mirrors/${mirrors_name}
221
-                git remote set-url origin ${repo_url}
222
-                if [[ ${repo_url} != 'ssh:'* ]]; then
223
-                    git fetch -p origin
224
-                else
225
-                    sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git fetch -p origin
226
-                fi
227
-            fi
228
-        fi
229
-    done
230
-    chown -R mirrors:mirrors /home/mirrors
231
-}
232
-
233
-function sync_mirrors_repos {
234
-    if [ ! $SYNC_SINGLE_APP ]; then
235
-        sync_mirrors_base "${UTILS_REPOS[@]}"
236
-    fi
237
-    sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}"
238
-}
239
-
240
-while [[ $# > 1 ]]
241
-do
242
-key="$1"
243
-
244
-case $key in
245
-    --help)
246
-    show_help
247
-    ;;
248
-    -s|--sync)
249
-    shift
250
-    # use repos on another server
251
-    FRIENDS_MIRRORS_SERVER="$1"
252
-    ;;
253
-    -m|--mypass|--mypassword)
254
-    shift
255
-    MY_MIRRORS_PASSWORD="$1"
256
-    write_config_param "MY_MIRRORS_PASSWORD" "${MY_MIRRORS_PASSWORD}"
257
-    ;;
258
-    -p|--pass|--password)
259
-    shift
260
-    FRIENDS_MIRRORS_PASSWORD="$1"
261
-    write_config_param "FRIENDS_MIRRORS_PASSWORD" "${FRIENDS_MIRRORS_PASSWORD}"
262
-    ;;
263
-    -n|--new)
264
-    shift
265
-    NEW_MIRRORS="$1"
266
-    ;;
267
-    --port)
268
-    shift
269
-    FRIENDS_MIRRORS_SSH_PORT=${1}
270
-    ;;
271
-    -a|--app)
272
-    shift
273
-    SYNC_SINGLE_APP="${1}"
274
-    ;;
275
-    *)
276
-    # unknown option
277
-    ;;
278
-esac
279
-shift
280
-done
281
-
282
-create_mirrors_user
283
-enable_mirrors_via_onion
284
-update_installed_apps_repos
285
-update_repos_from_friend
286
-sync_mirrors_repos
287
-
288
-exit 0

+ 0
- 7
src/freedombone-upgrade View File

37
 
37
 
38
 PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
38
 PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
39
 
39
 
40
-FRIENDS_MIRRORS_SERVER=
41
-FRIENDS_MIRRORS_SSH_PORT=2222
42
-FRIENDS_MIRRORS_PASSWORD=
43
-MY_MIRRORS_PASSWORD=
44
 CURRENT_BRANCH=master
40
 CURRENT_BRANCH=master
45
 
41
 
46
 # clear temporary files
42
 # clear temporary files
71
 
67
 
72
 update-ca-certificates
68
 update-ca-certificates
73
 
69
 
74
-read_repo_servers
75
-#${PROJECT_NAME}-mirrors
76
-
77
 if [ ! -d $PROJECT_DIR ]; then
70
 if [ ! -d $PROJECT_DIR ]; then
78
     git_clone $PROJECT_REPO $PROJECT_DIR
71
     git_clone $PROJECT_REPO $PROJECT_DIR
79
 fi
72
 fi

+ 1
- 7
src/freedombone-utils-config View File

28
 # You should have received a copy of the GNU Affero General Public License
28
 # You should have received a copy of the GNU Affero General Public License
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
 
30
 
31
-configuration_variables=(FRIENDS_MIRRORS_SERVER
32
-                         FRIENDS_MIRRORS_SSH_PORT
33
-                         FRIENDS_MIRRORS_PASSWORD
34
-                         MY_MIRRORS_PASSWORD
35
-                         SYSTEM_TYPE
31
+configuration_variables=(SYSTEM_TYPE
36
                          SSL_PROTOCOLS
32
                          SSL_PROTOCOLS
37
                          SSL_CIPHERS
33
                          SSL_CIPHERS
38
                          SSH_CIPHERS
34
                          SSH_CIPHERS
302
     fi
298
     fi
303
 
299
 
304
     if [ -f $CONFIGURATION_FILE ]; then
300
     if [ -f $CONFIGURATION_FILE ]; then
305
-        read_repo_servers
306
-
307
         # Ensure that a copy of the config exists for upgrade purposes
301
         # Ensure that a copy of the config exists for upgrade purposes
308
         if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
302
         if [[ $CONFIGURATION_FILE != "/root/${PROJECT_NAME}.cfg" ]]; then
309
             cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg
303
             cp $CONFIGURATION_FILE /root/${PROJECT_NAME}.cfg

+ 0
- 26
src/freedombone-utils-git View File

32
     repo_url="$1"
32
     repo_url="$1"
33
     destination_dir="$2"
33
     destination_dir="$2"
34
 
34
 
35
-    if [[ "$repo_url" == 'ssh:'* ]]; then
36
-        if [ "${FRIENDS_MIRRORS_SERVER}" ]; then
37
-            if [ ${#FRIENDS_MIRRORS_SERVER} -gt 2 ]; then
38
-                if [ "$FRIENDS_MIRRORS_PASSWORD" ]; then
39
-                    if [ ${#FRIENDS_MIRRORS_PASSWORD} -gt 2 ]; then
40
-                        echo "sshpass -p \"$FRIENDS_MIRRORS_PASSWORD\" git clone $repo_url $destination_dir"
41
-                        sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git clone "$repo_url" "$destination_dir"
42
-                        return
43
-                    fi
44
-                fi
45
-            fi
46
-        fi
47
-    fi
48
     echo "git clone $repo_url $destination_dir"
35
     echo "git clone $repo_url $destination_dir"
49
     git clone --recursive "$repo_url" "$destination_dir"
36
     git clone --recursive "$repo_url" "$destination_dir"
50
 }
37
 }
58
     git stash
45
     git stash
59
     git remote set-url origin $1
46
     git remote set-url origin $1
60
     git checkout master
47
     git checkout master
61
-    if [ "${FRIENDS_MIRRORS_SERVER}" ]; then
62
-        if [ ${#FRIENDS_MIRRORS_SERVER} -gt 2 ]; then
63
-            if [ "$FRIENDS_MIRRORS_PASSWORD" ]; then
64
-                if [ ${#FRIENDS_MIRRORS_PASSWORD} -gt 2 ]; then
65
-                    sshpass -p "$FRIENDS_MIRRORS_PASSWORD" git pull
66
-                    if [ $2 ]; then
67
-                        git checkout $2 -b $2
68
-                    fi
69
-                    return
70
-                fi
71
-            fi
72
-        fi
73
-    fi
74
     git pull
48
     git pull
75
 
49
 
76
     if [ $2 ]; then
50
     if [ $2 ]; then

+ 0
- 58
src/freedombone-utils-repos View File

31
 # The Debian package repository to use.
31
 # The Debian package repository to use.
32
 DEBIAN_REPO="ftp.us.debian.org"
32
 DEBIAN_REPO="ftp.us.debian.org"
33
 
33
 
34
-# password used for accessing your repo mirrors
35
-MY_MIRRORS_PASSWORD=
36
-# friend's repo mirrors
37
-FRIENDS_MIRRORS_PASSWORD=
38
-FRIENDS_MIRRORS_SERVER=
39
-FRIENDS_MIRRORS_SSH_PORT=2222
40
-
41
 function create_repo_sources {
34
 function create_repo_sources {
42
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
35
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
43
         return
36
         return
63
     mark_completed $FUNCNAME
56
     mark_completed $FUNCNAME
64
 }
57
 }
65
 
58
 
66
-function read_repo_servers {
67
-    read_config_param FRIENDS_MIRRORS_SERVER
68
-    read_config_param FRIENDS_MIRRORS_SSH_PORT
69
-    read_config_param MY_MIRRORS_PASSWORD
70
-    read_config_param FRIENDS_MIRRORS_PASSWORD
71
-
72
-    if [ ! $FRIENDS_MIRRORS_SERVER ]; then
73
-        return
74
-    fi
75
-    if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then
76
-        return
77
-    fi
78
-
79
-    APP_FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
80
-    for f in $APP_FILES
81
-    do
82
-        REPOS=($(cat ${f} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
83
-        for line in "${REPOS[@]}"
84
-        do
85
-            repo_name=$(echo "$line" | awk -F '=' '{print $1}')
86
-            mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
87
-            friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
88
-            export ${repo_name}="${friends_repo_url}"
89
-        done
90
-    done
91
-
92
-    APP_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
93
-    for f in $APP_FILES
94
-    do
95
-        REPOS=($(cat ${f} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
96
-        for line in "${REPOS[@]}"
97
-        do
98
-            repo_name=$(echo "$line" | awk -F '=' '{print $1}')
99
-            mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
100
-            friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
101
-            export ${repo_name}="${friends_repo_url}"
102
-        done
103
-    done
104
-}
105
-
106
 # A command to create a git repository for a project
59
 # A command to create a git repository for a project
107
 function create_git_project {
60
 function create_git_project {
108
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
61
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
136
     mark_completed $FUNCNAME
89
     mark_completed $FUNCNAME
137
 }
90
 }
138
 
91
 
139
-function create_mirrors {
140
-    if [ -d /home/trove ]; then
141
-        userdel -r trove
142
-    fi
143
-    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
144
-        return
145
-    fi
146
-    #${PROJECT_NAME}-mirrors
147
-    mark_completed $FUNCNAME
148
-}
149
-
150
 # NOTE: deliberately no exit 0
92
 # NOTE: deliberately no exit 0

+ 0
- 4
src/freedombone-utils-selector View File

572
                             function_check add_users_after_install
572
                             function_check add_users_after_install
573
                             add_users_after_install ${a}
573
                             add_users_after_install ${a}
574
 
574
 
575
-                            #${PROJECT_NAME}-mirrors --app ${a}
576
-
577
                             function_check lockdown_permissions
575
                             function_check lockdown_permissions
578
                             lockdown_permissions
576
                             lockdown_permissions
579
 
577
 
609
                                 function_check lockdown_permissions
607
                                 function_check lockdown_permissions
610
                                 lockdown_permissions
608
                                 lockdown_permissions
611
 
609
 
612
-                                #${PROJECT_NAME}-mirrors --app ${a}
613
-
614
                                 function_check install_completed
610
                                 function_check install_completed
615
                                 install_completed ${a}
611
                                 install_completed ${a}
616
                                 echo $"${a} was installed"
612
                                 echo $"${a} was installed"

+ 0
- 3
src/freedombone-utils-setup View File

836
     function_check regenerate_ssh_keys
836
     function_check regenerate_ssh_keys
837
     regenerate_ssh_keys
837
     regenerate_ssh_keys
838
 
838
 
839
-    function_check create_mirrors
840
-    create_mirrors
841
-
842
     function_check create_upgrade_script
839
     function_check create_upgrade_script
843
     create_upgrade_script
840
     create_upgrade_script
844
 
841
 

+ 1
- 1
src/freedombone-utils-validation View File

62
 
62
 
63
 function is_valid_user {
63
 function is_valid_user {
64
     USRNAME="$1"
64
     USRNAME="$1"
65
-    if [[ "$USRNAME" != "turtl" && "$USRNAME" != "znc" && "$USRNAME" != "pihole" && "$USRNAME" != "fbone" && "$USRNAME" != "go" && "$USRNAME" != "gogs" && "$USRNAME" != "git" && "$USRNAME" != "mirrors" && "$USRNAME" != "sync" && "$USRNAME" != "tahoelafs" ]]; then
65
+    if [[ "$USRNAME" != "turtl" && "$USRNAME" != "znc" && "$USRNAME" != "pihole" && "$USRNAME" != "fbone" && "$USRNAME" != "go" && "$USRNAME" != "gogs" && "$USRNAME" != "git" && "$USRNAME" != "sync" && "$USRNAME" != "tahoelafs" ]]; then
66
         echo "1"
66
         echo "1"
67
     else
67
     else
68
         echo "0"
68
         echo "0"