Kaynağa Gözat

Add a tahoelafs introducer to the full install

Bob Mottram 8 yıl önce
ebeveyn
işleme
3856005b72

+ 411
- 411
src/freedombone-app-blog Dosyayı Görüntüle

@@ -39,481 +39,481 @@ MY_BLOG_TITLE="My Blog"
39 39
 MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
40 40
 
41 41
 function reconfigure_blog {
42
-	echo -n ''
42
+    echo -n ''
43 43
 }
44 44
 
45 45
 function upgrade_blog {
46
-	if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
47
-		return
48
-	fi
49
-	function_check set_repo_commit
50
-	set_repo_commit /var/www/$FULLBLOG_DOMAIN_NAME/htdocs "Blog commit" "$FULLBLOG_COMMIT" $FULLBLOG_REPO
51
-
52
-	# update blog avatar
53
-	${PROJECT_NAME}-blog
46
+    if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
47
+        return
48
+    fi
49
+    function_check set_repo_commit
50
+    set_repo_commit /var/www/$FULLBLOG_DOMAIN_NAME/htdocs "Blog commit" "$FULLBLOG_COMMIT" $FULLBLOG_REPO
51
+
52
+    # update blog avatar
53
+    ${PROJECT_NAME}-blog
54 54
 }
55 55
 
56 56
 function backup_local_blog {
57
-	FULLBLOG_DOMAIN_NAME='blog'
58
-	if grep -q "Blog domain" $COMPLETION_FILE; then
59
-		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
60
-	fi
57
+    FULLBLOG_DOMAIN_NAME='blog'
58
+    if grep -q "Blog domain" $COMPLETION_FILE; then
59
+        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
60
+    fi
61 61
 
62
-	source_directory=/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
63
-	if [ -d $source_directory ]; then
64
-		dest_directory=blog
65
-		echo $"Backing up $source_directory to $dest_directory"
62
+    source_directory=/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
63
+    if [ -d $source_directory ]; then
64
+        dest_directory=blog
65
+        echo $"Backing up $source_directory to $dest_directory"
66 66
 
67
-		function_check suspend_site
68
-		suspend_site ${FULLBLOG_DOMAIN_NAME}
67
+        function_check suspend_site
68
+        suspend_site ${FULLBLOG_DOMAIN_NAME}
69 69
 
70
-		function_check backup_directory_to_usb
71
-		backup_directory_to_usb $source_directory $dest_directory
70
+        function_check backup_directory_to_usb
71
+        backup_directory_to_usb $source_directory $dest_directory
72 72
 
73
-		function_check restart_site
74
-		restart_site
73
+        function_check restart_site
74
+        restart_site
75 75
 
76
-		echo $"Backup to $dest_directory complete"
77
-	fi
76
+        echo $"Backup to $dest_directory complete"
77
+    fi
78 78
 }
79 79
 
80 80
 function restore_local_blog {
81
-	FULLBLOG_DOMAIN_NAME='blog'
82
-	if grep -q "Blog domain" $COMPLETION_FILE; then
83
-		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
84
-	fi
85
-	if [ $FULLBLOG_DOMAIN_NAME ]; then
86
-		echo $"Restoring blog installation"
87
-		temp_restore_dir=/root/tempblog
88
-		restore_directory_from_usb $temp_restore_dir blog
89
-		rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
90
-		cp -r $temp_restore_dir/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
91
-		if [ ! "$?" = "0" ]; then
92
-			set_user_permissions
93
-			backup_unmount_drive
94
-			exit 593
95
-		fi
96
-		rm -rf $temp_restore_dir
97
-		if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
98
-			echo $"No content directory found after restoring blog"
99
-			set_user_permissions
100
-			backup_unmount_drive
101
-			exit 287
102
-		fi
103
-		chown -R www-data:www-data /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
104
-		# Ensure that the bundled SSL cert is being used
105
-		if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
106
-			sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
107
-		fi
108
-		for d in /home/*/ ; do
109
-			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
110
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
111
-				if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
112
-					mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
113
-				fi
114
-			fi
115
-		done
116
-		if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
117
-			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
118
-			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
119
-		fi
120
-	fi
81
+    FULLBLOG_DOMAIN_NAME='blog'
82
+    if grep -q "Blog domain" $COMPLETION_FILE; then
83
+        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
84
+    fi
85
+    if [ $FULLBLOG_DOMAIN_NAME ]; then
86
+        echo $"Restoring blog installation"
87
+        temp_restore_dir=/root/tempblog
88
+        restore_directory_from_usb $temp_restore_dir blog
89
+        rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
90
+        cp -r $temp_restore_dir/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
91
+        if [ ! "$?" = "0" ]; then
92
+            set_user_permissions
93
+            backup_unmount_drive
94
+            exit 593
95
+        fi
96
+        rm -rf $temp_restore_dir
97
+        if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
98
+            echo $"No content directory found after restoring blog"
99
+            set_user_permissions
100
+            backup_unmount_drive
101
+            exit 287
102
+        fi
103
+        chown -R www-data:www-data /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
104
+        # Ensure that the bundled SSL cert is being used
105
+        if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
106
+            sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
107
+        fi
108
+        for d in /home/*/ ; do
109
+            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
110
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
111
+                if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
112
+                    mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
113
+                fi
114
+            fi
115
+        done
116
+        if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
117
+            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
118
+            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
119
+        fi
120
+    fi
121 121
 }
122 122
 
123 123
 function backup_remote_blog {
124
-	if grep -q "Blog domain" $COMPLETION_FILE; then
125
-		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
126
-		temp_backup_dir=/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
127
-		if [ -d $temp_backup_dir ]; then
128
-			echo $"Backing up blog"
129
-			backup_directory_to_friend $temp_backup_dir blog
130
-			echo $"Backup of blog complete"
131
-		else
132
-			echo $"Blog domain specified but not found in $temp_backup_dir"
133
-			exit 2578
134
-		fi
135
-	fi
124
+    if grep -q "Blog domain" $COMPLETION_FILE; then
125
+        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
126
+        temp_backup_dir=/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
127
+        if [ -d $temp_backup_dir ]; then
128
+            echo $"Backing up blog"
129
+            backup_directory_to_friend $temp_backup_dir blog
130
+            echo $"Backup of blog complete"
131
+        else
132
+            echo $"Blog domain specified but not found in $temp_backup_dir"
133
+            exit 2578
134
+        fi
135
+    fi
136 136
 }
137 137
 
138 138
 function restore_remote_blog {
139
-	if [ -d $SERVER_DIRECTORY/backup/blog ]; then
140
-		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
141
-		echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
142
-		temp_restore_dir=/root/tempblog
143
-		mkdir $temp_restore_dir
144
-		function_check restore_directory_from_friend
145
-		restore_directory_from_friend $temp_restore_dir blog
146
-		rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
147
-		cp -r $temp_restore_dir/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
148
-		if [ ! "$?" = "0" ]; then
149
-			exit 593
150
-		fi
151
-		rm -rf $temp_restore_dir
152
-		if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
153
-			echo $"No content directory found after restoring blog"
154
-			exit 287
155
-		fi
156
-		# Ensure that the bundled SSL cert is being used
157
-		if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
158
-			sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
159
-		fi
160
-		for d in /home/*/ ; do
161
-			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
162
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
163
-				if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
164
-					mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
165
-				fi
166
-			fi
167
-		done
168
-		if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
169
-			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
170
-			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
171
-		fi
172
-		echo $"Restore of blog complete"
173
-	fi
139
+    if [ -d $SERVER_DIRECTORY/backup/blog ]; then
140
+        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
141
+        echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
142
+        temp_restore_dir=/root/tempblog
143
+        mkdir $temp_restore_dir
144
+        function_check restore_directory_from_friend
145
+        restore_directory_from_friend $temp_restore_dir blog
146
+        rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
147
+        cp -r $temp_restore_dir/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
148
+        if [ ! "$?" = "0" ]; then
149
+            exit 593
150
+        fi
151
+        rm -rf $temp_restore_dir
152
+        if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
153
+            echo $"No content directory found after restoring blog"
154
+            exit 287
155
+        fi
156
+        # Ensure that the bundled SSL cert is being used
157
+        if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
158
+            sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
159
+        fi
160
+        for d in /home/*/ ; do
161
+            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
162
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
163
+                if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
164
+                    mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
165
+                fi
166
+            fi
167
+        done
168
+        if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
169
+            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
170
+            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
171
+        fi
172
+        echo $"Restore of blog complete"
173
+    fi
174 174
 }
175 175
 
176 176
 function remove_blog {
177
-	if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
178
-		return
179
-	fi
180
-	if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
181
-		rm -rf /var/www/$FULLBLOG_DOMAIN_NAME
182
-	fi
183
-	nginx_dissite $FULLBLOG_DOMAIN_NAME
184
-	if [ ! -f /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME ]; then
185
-		rm -rf /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
186
-	fi
187
-	if [ $FULLBLOG_CODE ]; then
188
-		if [ -f /usr/bin/dynamicdns ]; then
189
-			sed -i "/$FULLBLOG_DOMAIN_NAME/d" /usr/bin/dynamicdns
190
-			sed -i "/$FULLBLOG_CODE/d" /usr/bin/dynamicdns
191
-		fi
192
-	fi
193
-	function_check remove_onion_service
194
-	remove_onion_service blog ${FULLBLOG_ONION_PORT}
195
-	sed -i '/install_blog/d' $COMPLETION_FILE
196
-	sed -i '/Blog .*/d' $COMPLETION_FILE
177
+    if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
178
+        return
179
+    fi
180
+    if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
181
+        rm -rf /var/www/$FULLBLOG_DOMAIN_NAME
182
+    fi
183
+    nginx_dissite $FULLBLOG_DOMAIN_NAME
184
+    if [ ! -f /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME ]; then
185
+        rm -rf /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
186
+    fi
187
+    if [ $FULLBLOG_CODE ]; then
188
+        if [ -f /usr/bin/dynamicdns ]; then
189
+            sed -i "/$FULLBLOG_DOMAIN_NAME/d" /usr/bin/dynamicdns
190
+            sed -i "/$FULLBLOG_CODE/d" /usr/bin/dynamicdns
191
+        fi
192
+    fi
193
+    function_check remove_onion_service
194
+    remove_onion_service blog ${FULLBLOG_ONION_PORT}
195
+    sed -i '/install_blog/d' $COMPLETION_FILE
196
+    sed -i '/Blog .*/d' $COMPLETION_FILE
197 197
 }
198 198
 
199 199
 function get_blog_admin_password {
200
-	if [ -f /home/$MY_USERNAME/README ]; then
201
-		if grep -q "Your blog password is" /home/$MY_USERNAME/README; then
202
-			FULLBLOG_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your blog password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
203
-		fi
204
-	fi
200
+    if [ -f /home/$MY_USERNAME/README ]; then
201
+        if grep -q "Your blog password is" /home/$MY_USERNAME/README; then
202
+            FULLBLOG_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Your blog password is" | awk -F ':' '{print $2}' | sed 's/^ *//')
203
+        fi
204
+    fi
205 205
 }
206 206
 
207 207
 function install_blog_social_networks {
208
-	# set social networks
209
-	if grep -q "social.hubzilla" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini; then
210
-		sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
211
-		sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
212
-	fi
213
-	if grep -q "social.gnusocial" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini; then
214
-		sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
215
-		sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROBLOG_DOMAIN_NAME\"|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
216
-	fi
217
-
218
-	# clear proprietary social network strings
219
-	sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
220
-	sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
221
-	sed -i 's|social.google.*|social.google = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
208
+    # set social networks
209
+    if grep -q "social.hubzilla" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini; then
210
+        sed -i "s|;social.hubzilla|social.hubzilla|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
211
+        sed -i "s|social.hubzilla.*|social.hubzilla = \"$HUBZILLA_DOMAIN_NAME\"|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
212
+    fi
213
+    if grep -q "social.gnusocial" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini; then
214
+        sed -i "s|;social.gnusocial|social.gnusocial|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
215
+        sed -i "s|social.gnusocial.*|social.gnusocial = \"$MICROBLOG_DOMAIN_NAME\"|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
216
+    fi
217
+
218
+    # clear proprietary social network strings
219
+    sed -i 's|social.facebook.*|social.facebook = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
220
+    sed -i 's|social.twitter.*|social.twitter = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
221
+    sed -i 's|social.google.*|social.google = ""|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
222 222
 }
223 223
 
224 224
 function install_blog_user {
225
-	# create a user password
226
-	function_check get_blog_admin_password
227
-	get_blog_admin_password
228
-	if [ ! $FULLBLOG_ADMIN_PASSWORD ]; then
229
-		if [ -f $IMAGE_PASSWORD_FILE ]; then
230
-			FULLBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
231
-		else
232
-			FULLBLOG_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
233
-		fi
234
-		echo '' >> /home/$MY_USERNAME/README
235
-		echo '' >> /home/$MY_USERNAME/README
236
-		echo $'HTMLy Blog' >> /home/$MY_USERNAME/README
237
-		echo '==========' >> /home/$MY_USERNAME/README
238
-		echo $"Your blog username: $MY_USERNAME" >> /home/$MY_USERNAME/README
239
-		echo $"Your blog password is: $FULLBLOG_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
240
-		if [[ $ONION_ONLY == 'no' ]]; then
241
-			echo $"Log into your blog at https://$FULLBLOG_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
242
-		fi
243
-		chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
244
-		chmod 600 /home/$MY_USERNAME/README
245
-	fi
246
-
247
-	# create a user
248
-	FULLBLOG_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --bloghash "$FULLBLOG_ADMIN_PASSWORD")
249
-	if [ ${#FULLBLOG_ADMIN_PASSWORD_HASH} -lt 8 ]; then
250
-		echo $'Blog admin password could not be hashed'
251
-		exit 625728
252
-	fi
253
-	echo ';Password' > /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
254
-	echo "password = $FULLBLOG_ADMIN_PASSWORD_HASH" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
255
-	echo 'encryption = password_hash' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
256
-	echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
257
-	echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
225
+    # create a user password
226
+    function_check get_blog_admin_password
227
+    get_blog_admin_password
228
+    if [ ! $FULLBLOG_ADMIN_PASSWORD ]; then
229
+        if [ -f $IMAGE_PASSWORD_FILE ]; then
230
+            FULLBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
231
+        else
232
+            FULLBLOG_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
233
+        fi
234
+        echo '' >> /home/$MY_USERNAME/README
235
+        echo '' >> /home/$MY_USERNAME/README
236
+        echo $'HTMLy Blog' >> /home/$MY_USERNAME/README
237
+        echo '==========' >> /home/$MY_USERNAME/README
238
+        echo $"Your blog username: $MY_USERNAME" >> /home/$MY_USERNAME/README
239
+        echo $"Your blog password is: $FULLBLOG_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
240
+        if [[ $ONION_ONLY == 'no' ]]; then
241
+            echo $"Log into your blog at https://$FULLBLOG_DOMAIN_NAME/login" >> /home/$MY_USERNAME/README
242
+        fi
243
+        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
244
+        chmod 600 /home/$MY_USERNAME/README
245
+    fi
246
+
247
+    # create a user
248
+    FULLBLOG_ADMIN_PASSWORD_HASH=$(${PROJECT_NAME}-sec --bloghash "$FULLBLOG_ADMIN_PASSWORD")
249
+    if [ ${#FULLBLOG_ADMIN_PASSWORD_HASH} -lt 8 ]; then
250
+        echo $'Blog admin password could not be hashed'
251
+        exit 625728
252
+    fi
253
+    echo ';Password' > /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
254
+    echo "password = $FULLBLOG_ADMIN_PASSWORD_HASH" >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
255
+    echo 'encryption = password_hash' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
256
+    echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
257
+    echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
258 258
 }
259 259
 
260 260
 function install_blog_settings {
261
-	cp /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
262
-	sed -i "s|site.url.*|site.url = '/'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
263
-	sed -i "s|blog.title.*|blog.title = '$MY_BLOG_TITLE'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
264
-	sed -i "s|blog.tagline.*|blog.tagline = '$MY_BLOG_SUBTITLE'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
265
-	sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
266
-	sed -i "s|Your name|$MY_NAME|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
261
+    cp /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini.example /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
262
+    sed -i "s|site.url.*|site.url = '/'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
263
+    sed -i "s|blog.title.*|blog.title = '$MY_BLOG_TITLE'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
264
+    sed -i "s|blog.tagline.*|blog.tagline = '$MY_BLOG_SUBTITLE'|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
265
+    sed -i 's|timezone.*|timezone = "Europe/London"|g' /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
266
+    sed -i "s|Your name|$MY_NAME|g" /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/config.ini
267 267
 }
268 268
 
269 269
 function install_blog_website {
270
-	function_check nginx_http_redirect
271
-	nginx_http_redirect $FULLBLOG_DOMAIN_NAME
272
-	echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
273
-	echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
274
-	echo "    root /var/www/$FULLBLOG_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
275
-	echo "    server_name $FULLBLOG_DOMAIN_NAME;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
276
-	echo '    access_log off;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
277
-	echo "    error_log /var/log/nginx/${FULLBLOG_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
278
-	echo '    index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
279
-	echo '    charset utf-8;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
280
-	echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
281
-	function_check nginx_limits
282
-	nginx_limits $FULLBLOG_DOMAIN_NAME
283
-	function_check nginx_ssl
284
-	nginx_ssl $FULLBLOG_DOMAIN_NAME
285
-	function_check nginx_disable_sniffing
286
-	nginx_disable_sniffing $FULLBLOG_DOMAIN_NAME
287
-	echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
288
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
289
-	echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
290
-	echo '    location / {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
291
-	echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
292
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
293
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
294
-	echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
295
-	echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
296
-	echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
297
-	echo '        allow all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
298
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
299
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
300
-	echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
301
-	echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
302
-	echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
303
-	echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
304
-	echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
305
-	echo '        expires 30d;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
306
-	echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
307
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
308
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
309
-	echo '    # block these file types' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
310
-	echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
311
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
312
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
313
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
314
-	echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
315
-	echo '    # or a unix socket' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
316
-	echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
317
-	echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
318
-	echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
319
-	echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
320
-	echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
321
-	echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
322
-	echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
323
-	echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
324
-	echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
325
-	echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
326
-	echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
327
-	echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
328
-	echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
329
-	echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
330
-	echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
331
-	echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
332
-	echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
333
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
334
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
335
-	echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
336
-	echo '    location ~ /\. {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
337
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
338
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
339
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
340
-	echo '    #deny access to store' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
341
-	echo '    location ~ /store {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
342
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
343
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
344
-	echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
345
-	echo '      deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
346
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
347
-	echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
348
-	echo '      deny  all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
349
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
350
-	echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
351
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
270
+    function_check nginx_http_redirect
271
+    nginx_http_redirect $FULLBLOG_DOMAIN_NAME
272
+    echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
273
+    echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
274
+    echo "    root /var/www/$FULLBLOG_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
275
+    echo "    server_name $FULLBLOG_DOMAIN_NAME;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
276
+    echo '    access_log off;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
277
+    echo "    error_log /var/log/nginx/${FULLBLOG_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
278
+    echo '    index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
279
+    echo '    charset utf-8;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
280
+    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
281
+    function_check nginx_limits
282
+    nginx_limits $FULLBLOG_DOMAIN_NAME
283
+    function_check nginx_ssl
284
+    nginx_ssl $FULLBLOG_DOMAIN_NAME
285
+    function_check nginx_disable_sniffing
286
+    nginx_disable_sniffing $FULLBLOG_DOMAIN_NAME
287
+    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
288
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
289
+    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
290
+    echo '    location / {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
291
+    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
292
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
293
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
294
+    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
295
+    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
296
+    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
297
+    echo '        allow all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
298
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
299
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
300
+    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
301
+    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
302
+    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
303
+    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
304
+    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
305
+    echo '        expires 30d;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
306
+    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
307
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
308
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
309
+    echo '    # block these file types' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
310
+    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
311
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
312
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
313
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
314
+    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
315
+    echo '    # or a unix socket' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
316
+    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
317
+    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
318
+    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
319
+    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
320
+    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
321
+    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
322
+    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
323
+    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
324
+    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
325
+    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
326
+    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
327
+    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
328
+    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
329
+    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
330
+    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
331
+    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
332
+    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
333
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
334
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
335
+    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
336
+    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
337
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
338
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
339
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
340
+    echo '    #deny access to store' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
341
+    echo '    location ~ /store {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
342
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
343
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
344
+    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
345
+    echo '      deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
346
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
347
+    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
348
+    echo '      deny  all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
349
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
350
+    echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
351
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
352 352
 }
353 353
 
354 354
 function install_blog_website_onion {
355
-	echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
356
-	echo "    listen 127.0.0.1:${FULLBLOG_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
357
-	echo "    root /var/www/$FULLBLOG_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
358
-	echo "    server_name $FULLBLOG_DOMAIN_NAME;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
359
-	echo '    access_log off;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
360
-	echo "    error_log /var/log/nginx/${FULLBLOG_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
361
-	echo '    index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
362
-	echo '    charset utf-8;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
363
-	echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
364
-	function_check nginx_limits
365
-	nginx_limits $FULLBLOG_DOMAIN_NAME
366
-	function_check nginx_disable_sniffing
367
-	nginx_disable_sniffing $FULLBLOG_DOMAIN_NAME
368
-	echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
369
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
370
-	echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
371
-	echo '    location / {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
372
-	echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
373
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
374
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
375
-	echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
376
-	echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
377
-	echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
378
-	echo '        allow all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
379
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
380
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
381
-	echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
382
-	echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
383
-	echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
384
-	echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
385
-	echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
386
-	echo '        expires 30d;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
387
-	echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
388
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
389
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
390
-	echo '    # block these file types' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
391
-	echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
392
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
393
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
394
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
395
-	echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
396
-	echo '    # or a unix socket' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
397
-	echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
398
-	echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
399
-	echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
400
-	echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
401
-	echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
402
-	echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
403
-	echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
404
-	echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
405
-	echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
406
-	echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
407
-	echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
408
-	echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
409
-	echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
410
-	echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
411
-	echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
412
-	echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
413
-	echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
414
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
415
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
416
-	echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
417
-	echo '    location ~ /\. {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
418
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
419
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
420
-	echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
421
-	echo '    #deny access to store' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
422
-	echo '    location ~ /store {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
423
-	echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
424
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
425
-	echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
426
-	echo '      deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
427
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
428
-	echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
429
-	echo '      deny  all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
430
-	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
431
-	echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
355
+    echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
356
+    echo "    listen 127.0.0.1:${FULLBLOG_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
357
+    echo "    root /var/www/$FULLBLOG_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
358
+    echo "    server_name $FULLBLOG_DOMAIN_NAME;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
359
+    echo '    access_log off;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
360
+    echo "    error_log /var/log/nginx/${FULLBLOG_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
361
+    echo '    index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
362
+    echo '    charset utf-8;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
363
+    echo '    proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
364
+    function_check nginx_limits
365
+    nginx_limits $FULLBLOG_DOMAIN_NAME
366
+    function_check nginx_disable_sniffing
367
+    nginx_disable_sniffing $FULLBLOG_DOMAIN_NAME
368
+    echo '    add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
369
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
370
+    echo '    # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
371
+    echo '    location / {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
372
+    echo '        rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
373
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
374
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
375
+    echo "    # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
376
+    echo '    # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
377
+    echo '    location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
378
+    echo '        allow all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
379
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
380
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
381
+    echo '    # statically serve these file types when possible' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
382
+    echo '    # otherwise fall back to front controller' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
383
+    echo '    # allow browser to cache them' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
384
+    echo '    # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
385
+    echo '    location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
386
+    echo '        expires 30d;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
387
+    echo '        try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
388
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
389
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
390
+    echo '    # block these file types' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
391
+    echo '    location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
392
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
393
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
394
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
395
+    echo '    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
396
+    echo '    # or a unix socket' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
397
+    echo '    location ~* \.php$ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
398
+    echo '        # Zero-day exploit defense.' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
399
+    echo '        # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
400
+    echo "        # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
401
+    echo "        # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
402
+    echo "        # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
403
+    echo "        # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
404
+    echo '        try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
405
+    echo '        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
406
+    echo '        fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
407
+    echo '        # With php5-cgi alone:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
408
+    echo '        # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
409
+    echo '        # With php5-fpm:' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
410
+    echo '        fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
411
+    echo '        include fastcgi_params;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
412
+    echo '        fastcgi_index index.php;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
413
+    echo '        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
414
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
415
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
416
+    echo '    # deny access to all dot files' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
417
+    echo '    location ~ /\. {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
418
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
419
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
420
+    echo '' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
421
+    echo '    #deny access to store' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
422
+    echo '    location ~ /store {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
423
+    echo '        deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
424
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
425
+    echo '    location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
426
+    echo '      deny all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
427
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
428
+    echo '    location ~ /\.ht {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
429
+    echo '      deny  all;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
430
+    echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
431
+    echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
432 432
 }
433 433
 
434 434
 function install_blog_from_repo {
435
-	if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
436
-		mkdir /var/www/$FULLBLOG_DOMAIN_NAME
437
-	fi
438
-
439
-	cd /var/www/$FULLBLOG_DOMAIN_NAME
440
-	git_clone $FULLBLOG_REPO htdocs
441
-	cd htdocs
442
-	git checkout $FULLBLOG_COMMIT -b $FULLBLOG_COMMIT
443
-	if ! grep -q "Blog commit" $COMPLETION_FILE; then
444
-		echo "Blog commit:$FULLBLOG_COMMIT" >> $COMPLETION_FILE
445
-	else
446
-		sed -i "s/Blog commit.*/Blog commit:$FULLBLOG_COMMIT/g" $COMPLETION_FILE
447
-	fi
435
+    if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
436
+        mkdir /var/www/$FULLBLOG_DOMAIN_NAME
437
+    fi
438
+
439
+    cd /var/www/$FULLBLOG_DOMAIN_NAME
440
+    git_clone $FULLBLOG_REPO htdocs
441
+    cd htdocs
442
+    git checkout $FULLBLOG_COMMIT -b $FULLBLOG_COMMIT
443
+    if ! grep -q "Blog commit" $COMPLETION_FILE; then
444
+        echo "Blog commit:$FULLBLOG_COMMIT" >> $COMPLETION_FILE
445
+    else
446
+        sed -i "s/Blog commit.*/Blog commit:$FULLBLOG_COMMIT/g" $COMPLETION_FILE
447
+    fi
448 448
 }
449 449
 
450 450
 function install_blog {
451
-	if [ ! $FULLBLOG_DOMAIN_NAME ]; then
452
-		echo $'The blog domain name was not specified'
453
-		exit 5062
454
-	fi
451
+    if [ ! $FULLBLOG_DOMAIN_NAME ]; then
452
+        echo $'The blog domain name was not specified'
453
+        exit 5062
454
+    fi
455 455
 
456
-	if grep -Fxq "install_blog" $COMPLETION_FILE; then
457
-		return
458
-	fi
456
+    if grep -Fxq "install_blog" $COMPLETION_FILE; then
457
+        return
458
+    fi
459 459
 
460
-	# for the avatar changing command
461
-	apt-get -y install imagemagick
460
+    # for the avatar changing command
461
+    apt-get -y install imagemagick
462 462
 
463
-	function_check install_blog_from_repo
464
-	install_blog_from_repo
463
+    function_check install_blog_from_repo
464
+    install_blog_from_repo
465 465
 
466
-	if [[ $ONION_ONLY == "no" ]]; then
467
-		function_check install_blog_website
468
-		install_blog_website
469
-	else
470
-		echo -n '' > /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
471
-	fi
472
-	function_check install_blog_website_onion
473
-	install_blog_website_onion
466
+    if [[ $ONION_ONLY == "no" ]]; then
467
+        function_check install_blog_website
468
+        install_blog_website
469
+    else
470
+        echo -n '' > /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
471
+    fi
472
+    function_check install_blog_website_onion
473
+    install_blog_website_onion
474 474
 
475
-	function_check create_site_certificate
476
-	create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
475
+    function_check create_site_certificate
476
+    create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
477 477
 
478
-	function_check configure_php
479
-	configure_php
478
+    function_check configure_php
479
+    configure_php
480 480
 
481
-	function_check install_blog_settings
482
-	install_blog_settings
481
+    function_check install_blog_settings
482
+    install_blog_settings
483 483
 
484
-	function_check install_blog_social_networks
485
-	install_blog_social_networks
484
+    function_check install_blog_social_networks
485
+    install_blog_social_networks
486 486
 
487
-	function_check install_blog_user
488
-	install_blog_user
487
+    function_check install_blog_user
488
+    install_blog_user
489 489
 
490
-	chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
490
+    chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
491 491
 
492
-	FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
492
+    FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
493 493
 
494
-	function_check nginx_ensite
495
-	nginx_ensite $FULLBLOG_DOMAIN_NAME
494
+    function_check nginx_ensite
495
+    nginx_ensite $FULLBLOG_DOMAIN_NAME
496 496
 
497
-	systemctl restart php5-fpm
498
-	systemctl restart nginx
497
+    systemctl restart php5-fpm
498
+    systemctl restart nginx
499 499
 
500
-	if ! grep -q "Blog onion domain" /home/$MY_USERNAME/README; then
501
-		echo $"Blog onion domain: ${FULLBLOG_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
502
-		echo $"Log into your blog at https://${FULLBLOG_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
503
-		echo '' >> /home/$MY_USERNAME/README
504
-		chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
505
-		chmod 600 /home/$MY_USERNAME/README
506
-	fi
507
-	echo "Blog onion domain:${FULLBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
500
+    if ! grep -q "Blog onion domain" /home/$MY_USERNAME/README; then
501
+        echo $"Blog onion domain: ${FULLBLOG_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
502
+        echo $"Log into your blog at https://${FULLBLOG_ONION_HOSTNAME}/login" >> /home/$MY_USERNAME/README
503
+        echo '' >> /home/$MY_USERNAME/README
504
+        chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
505
+        chmod 600 /home/$MY_USERNAME/README
506
+    fi
507
+    echo "Blog onion domain:${FULLBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
508 508
 
509
-	function_check add_ddns_domain
510
-	add_ddns_domain $FULLBLOG_DOMAIN_NAME
509
+    function_check add_ddns_domain
510
+    add_ddns_domain $FULLBLOG_DOMAIN_NAME
511 511
 
512
-	if ! grep -q "Blog domain:" $COMPLETION_FILE; then
513
-		echo "Blog domain:$FULLBLOG_DOMAIN_NAME" >> $COMPLETION_FILE
514
-	fi
512
+    if ! grep -q "Blog domain:" $COMPLETION_FILE; then
513
+        echo "Blog domain:$FULLBLOG_DOMAIN_NAME" >> $COMPLETION_FILE
514
+    fi
515 515
 
516
-	echo 'install_blog' >> $COMPLETION_FILE
516
+    echo 'install_blog' >> $COMPLETION_FILE
517 517
 }
518 518
 
519 519
 # NOTE: deliberately no exit 0

+ 125
- 125
src/freedombone-app-emacs Dosyayı Görüntüle

@@ -31,154 +31,154 @@
31 31
 VARIANTS='all'
32 32
 
33 33
 function reconfigure_emacs {
34
-	echo -n ''
34
+    echo -n ''
35 35
 }
36 36
 
37 37
 function upgrade_emacs {
38
-	echo -n ''
38
+    echo -n ''
39 39
 }
40 40
 
41 41
 function backup_local_emacs {
42
-	for d in /home/*/ ; do
43
-		USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
44
-		if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
45
-			if [ -d /home/$USERNAME/.emacs.d ]; then
46
-				echo $"Backing up Emacs config for $USERNAME"
47
-				if [ -f /home/$USERNAME/.emacs ]; then
48
-					cp /home/$USERNAME/.emacs /home/$USERNAME/.emacs.d/dotemacs
49
-				fi
50
-				function_check backup_directory_to_usb
51
-				backup_directory_to_usb /home/$USERNAME/.emacs.d config/$USERNAME
52
-			fi
53
-		fi
54
-	done
42
+    for d in /home/*/ ; do
43
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
44
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
45
+            if [ -d /home/$USERNAME/.emacs.d ]; then
46
+                echo $"Backing up Emacs config for $USERNAME"
47
+                if [ -f /home/$USERNAME/.emacs ]; then
48
+                    cp /home/$USERNAME/.emacs /home/$USERNAME/.emacs.d/dotemacs
49
+                fi
50
+                function_check backup_directory_to_usb
51
+                backup_directory_to_usb /home/$USERNAME/.emacs.d config/$USERNAME
52
+            fi
53
+        fi
54
+    done
55 55
 }
56 56
 
57 57
 function restore_local_emacs {
58
-	temp_restore_dir=/root/tempemacs
59
-	if [ -d $USB_MOUNT/backup/emacs ]; then
60
-		for d in $USB_MOUNT/backup/emacs/*/ ; do
61
-			USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
62
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
63
-				if [ ! -d /home/$USERNAME ]; then
64
-					${PROJECT_NAME}-adduser $USERNAME
65
-				fi
66
-				echo $"Restoring Emacs config for $USERNAME"
67
-				function_check restore_directory_from_usb
68
-				restore_directory_from_usb $temp_restore_dir emacs/$USERNAME
69
-				cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
70
-				if [ ! "$?" = "0" ]; then
71
-					rm -rf $temp_restore_dir
72
-					function_check set_user_permissions
73
-					set_user_permissions
74
-					function_check backup_unmount_drive
75
-					backup_unmount_drive
76
-					exit 664
77
-				fi
78
-				cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
79
-				rm -rf $temp_restore_dir
80
-			fi
81
-		done
82
-	fi
58
+    temp_restore_dir=/root/tempemacs
59
+    if [ -d $USB_MOUNT/backup/emacs ]; then
60
+        for d in $USB_MOUNT/backup/emacs/*/ ; do
61
+            USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
62
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
63
+                if [ ! -d /home/$USERNAME ]; then
64
+                    ${PROJECT_NAME}-adduser $USERNAME
65
+                fi
66
+                echo $"Restoring Emacs config for $USERNAME"
67
+                function_check restore_directory_from_usb
68
+                restore_directory_from_usb $temp_restore_dir emacs/$USERNAME
69
+                cp -r $temp_restore_dir/home/$USERNAME/.emacs.d /home/$USERNAME/
70
+                if [ ! "$?" = "0" ]; then
71
+                    rm -rf $temp_restore_dir
72
+                    function_check set_user_permissions
73
+                    set_user_permissions
74
+                    function_check backup_unmount_drive
75
+                    backup_unmount_drive
76
+                    exit 664
77
+                fi
78
+                cp -f $temp_restore_dir/home/$USERNAME/.emacs.d/dotemacs /home/$USERNAME/.emacs
79
+                rm -rf $temp_restore_dir
80
+            fi
81
+        done
82
+    fi
83 83
 }
84 84
 
85 85
 function backup_remote_emacs {
86
-	echo -n ''
86
+    echo -n ''
87 87
 }
88 88
 
89 89
 function restore_remote_emacs {
90
-	echo -n ''
90
+    echo -n ''
91 91
 }
92 92
 
93 93
 function remove_emacs {
94
-	if ! grep -Fxq "install_emacs" $COMPLETION_FILE; then
95
-		return
96
-	fi
97
-	apt-get -y remove --purge emacs24
98
-	update-alternatives --set editor /usr/bin/nano
99
-	sed -i '/install_emacs/d' $COMPLETION_FILE
94
+    if ! grep -Fxq "install_emacs" $COMPLETION_FILE; then
95
+        return
96
+    fi
97
+    apt-get -y remove --purge emacs24
98
+    update-alternatives --set editor /usr/bin/nano
99
+    sed -i '/install_emacs/d' $COMPLETION_FILE
100 100
 }
101 101
 
102 102
 function install_emacs {
103
-	if grep -Fxq "install_emacs" $COMPLETION_FILE; then
104
-		return
105
-	fi
106
-	update-alternatives --set editor /usr/bin/emacs24
103
+    if grep -Fxq "install_emacs" $COMPLETION_FILE; then
104
+        return
105
+    fi
106
+    update-alternatives --set editor /usr/bin/emacs24
107 107
 
108
-	# A minimal emacs configuration
109
-	#echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs
110
-	#echo '"~/.emacs.d/")' >> /home/$MY_USERNAME/.emacs
111
-	#echo '' >> /home/$MY_USERNAME/.emacs
112
-	echo $';; ===== Remove trailing whitepace ======================================' >> /home/$MY_USERNAME/.emacs
113
-	echo '' >> /home/$MY_USERNAME/.emacs
114
-	echo ";;(add-hook 'before-save-hook 'delete-trailing-whitespace)" >> /home/$MY_USERNAME/.emacs
115
-	echo '' >> /home/$MY_USERNAME/.emacs
116
-	echo ';; Goto a line number with CTRL-l' >> /home/$MY_USERNAME/.emacs
117
-	echo -n '(global-set-key "\C-l" ' >> /home/$MY_USERNAME/.emacs
118
-	echo "'goto-line)" >> /home/$MY_USERNAME/.emacs
119
-	echo '' >> /home/$MY_USERNAME/.emacs
120
-	echo $';; ===== Show line numbers ==============================================' >> /home/$MY_USERNAME/.emacs
121
-	echo '' >> /home/$MY_USERNAME/.emacs
122
-	echo "(add-hook 'find-file-hook (lambda () (linum-mode 1)))" >> /home/$MY_USERNAME/.emacs
123
-	echo '' >> /home/$MY_USERNAME/.emacs
124
-	echo $';; ===== Enable line wrapping in org-mode ===============================' >> /home/$MY_USERNAME/.emacs
125
-	echo '' >> /home/$MY_USERNAME/.emacs
126
-	echo " (add-hook 'org-mode-hook" >> /home/$MY_USERNAME/.emacs
127
-	echo "           '(lambda ()" >> /home/$MY_USERNAME/.emacs
128
-	echo "              (visual-line-mode 1)))" >> /home/$MY_USERNAME/.emacs
129
-	echo '' >> /home/$MY_USERNAME/.emacs
130
-	echo $';; ===== Enable shift select in org mode ================================' >> /home/$MY_USERNAME/.emacs
131
-	echo '' >> /home/$MY_USERNAME/.emacs
132
-	echo '(setq org-support-shift-select t)' >> /home/$MY_USERNAME/.emacs
133
-	echo '' >> /home/$MY_USERNAME/.emacs
134
-	echo $';; ===== Set standard indent to 4 rather that 4 =========================' >> /home/$MY_USERNAME/.emacs
135
-	echo '' >> /home/$MY_USERNAME/.emacs
136
-	echo '(setq standard-indent 4)' >> /home/$MY_USERNAME/.emacs
137
-	echo '(setq-default tab-width 4)' >> /home/$MY_USERNAME/.emacs
138
-	echo '(setq c-basic-offset 4)' >> /home/$MY_USERNAME/.emacs
139
-	echo '' >> /home/$MY_USERNAME/.emacs
140
-	echo $';; ===== Support Wheel Mouse Scrolling ==================================' >> /home/$MY_USERNAME/.emacs
141
-	echo '' >> /home/$MY_USERNAME/.emacs
142
-	echo '(mouse-wheel-mode t)' >> /home/$MY_USERNAME/.emacs
143
-	echo '' >> /home/$MY_USERNAME/.emacs
144
-	echo $';; ===== Place Backup Files in Specific Directory =======================' >> /home/$MY_USERNAME/.emacs
145
-	echo '' >> /home/$MY_USERNAME/.emacs
146
-	echo '(setq make-backup-files t)' >> /home/$MY_USERNAME/.emacs
147
-	echo '(setq version-control t)' >> /home/$MY_USERNAME/.emacs
148
-	echo '(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))' >> /home/$MY_USERNAME/.emacs
149
-	echo '' >> /home/$MY_USERNAME/.emacs
150
-	echo $';; ===== Make Text mode the default mode for new buffers ================' >> /home/$MY_USERNAME/.emacs
151
-	echo '' >> /home/$MY_USERNAME/.emacs
152
-	echo "(setq default-major-mode 'text-mode)" >> /home/$MY_USERNAME/.emacs
153
-	echo '' >> /home/$MY_USERNAME/.emacs
154
-	echo $';; ===== Line length ====================================================' >> /home/$MY_USERNAME/.emacs
155
-	echo '' >> /home/$MY_USERNAME/.emacs
156
-	echo '(setq-default fill-column 72)' >> /home/$MY_USERNAME/.emacs
157
-	echo '' >> /home/$MY_USERNAME/.emacs
158
-	echo $';; ===== Enable Line and Column Numbering ===============================' >> /home/$MY_USERNAME/.emacs
159
-	echo '' >> /home/$MY_USERNAME/.emacs
160
-	echo '(line-number-mode 1)' >> /home/$MY_USERNAME/.emacs
161
-	echo '(column-number-mode 1)' >> /home/$MY_USERNAME/.emacs
162
-	echo '' >> /home/$MY_USERNAME/.emacs
163
-	echo $';; ===== Turn on Auto Fill mode automatically in all modes ==============' >> /home/$MY_USERNAME/.emacs
164
-	echo '' >> /home/$MY_USERNAME/.emacs
165
-	echo ';; Auto-fill-mode the the automatic wrapping of lines and insertion of' >> /home/$MY_USERNAME/.emacs
166
-	echo ';; newlines when the cursor goes over the column limit.' >> /home/$MY_USERNAME/.emacs
167
-	echo '' >> /home/$MY_USERNAME/.emacs
168
-	echo ';; This should actually turn on auto-fill-mode by default in all major' >> /home/$MY_USERNAME/.emacs
169
-	echo ';; modes. The other way to do this is to turn on the fill for specific modes' >> /home/$MY_USERNAME/.emacs
170
-	echo ';; via hooks.' >> /home/$MY_USERNAME/.emacs
171
-	echo '' >> /home/$MY_USERNAME/.emacs
172
-	echo '(setq auto-fill-mode 1)' >> /home/$MY_USERNAME/.emacs
173
-	echo '' >> /home/$MY_USERNAME/.emacs
174
-	echo $';; ===== Enable GPG encryption =========================================' >> /home/$MY_USERNAME/.emacs
175
-	echo '' >> /home/$MY_USERNAME/.emacs
176
-	echo "(require 'epa)" >> /home/$MY_USERNAME/.emacs
177
-	echo '(epa-file-enable)' >> /home/$MY_USERNAME/.emacs
178
-	cp /home/$MY_USERNAME/.emacs /root/.emacs
179
-	chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
108
+    # A minimal emacs configuration
109
+    #echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs
110
+    #echo '"~/.emacs.d/")' >> /home/$MY_USERNAME/.emacs
111
+    #echo '' >> /home/$MY_USERNAME/.emacs
112
+    echo $';; ===== Remove trailing whitepace ======================================' >> /home/$MY_USERNAME/.emacs
113
+    echo '' >> /home/$MY_USERNAME/.emacs
114
+    echo ";;(add-hook 'before-save-hook 'delete-trailing-whitespace)" >> /home/$MY_USERNAME/.emacs
115
+    echo '' >> /home/$MY_USERNAME/.emacs
116
+    echo ';; Goto a line number with CTRL-l' >> /home/$MY_USERNAME/.emacs
117
+    echo -n '(global-set-key "\C-l" ' >> /home/$MY_USERNAME/.emacs
118
+    echo "'goto-line)" >> /home/$MY_USERNAME/.emacs
119
+    echo '' >> /home/$MY_USERNAME/.emacs
120
+    echo $';; ===== Show line numbers ==============================================' >> /home/$MY_USERNAME/.emacs
121
+    echo '' >> /home/$MY_USERNAME/.emacs
122
+    echo "(add-hook 'find-file-hook (lambda () (linum-mode 1)))" >> /home/$MY_USERNAME/.emacs
123
+    echo '' >> /home/$MY_USERNAME/.emacs
124
+    echo $';; ===== Enable line wrapping in org-mode ===============================' >> /home/$MY_USERNAME/.emacs
125
+    echo '' >> /home/$MY_USERNAME/.emacs
126
+    echo " (add-hook 'org-mode-hook" >> /home/$MY_USERNAME/.emacs
127
+    echo "           '(lambda ()" >> /home/$MY_USERNAME/.emacs
128
+    echo "              (visual-line-mode 1)))" >> /home/$MY_USERNAME/.emacs
129
+    echo '' >> /home/$MY_USERNAME/.emacs
130
+    echo $';; ===== Enable shift select in org mode ================================' >> /home/$MY_USERNAME/.emacs
131
+    echo '' >> /home/$MY_USERNAME/.emacs
132
+    echo '(setq org-support-shift-select t)' >> /home/$MY_USERNAME/.emacs
133
+    echo '' >> /home/$MY_USERNAME/.emacs
134
+    echo $';; ===== Set standard indent to 4 rather that 4 =========================' >> /home/$MY_USERNAME/.emacs
135
+    echo '' >> /home/$MY_USERNAME/.emacs
136
+    echo '(setq standard-indent 4)' >> /home/$MY_USERNAME/.emacs
137
+    echo '(setq-default tab-width 4)' >> /home/$MY_USERNAME/.emacs
138
+    echo '(setq c-basic-offset 4)' >> /home/$MY_USERNAME/.emacs
139
+    echo '' >> /home/$MY_USERNAME/.emacs
140
+    echo $';; ===== Support Wheel Mouse Scrolling ==================================' >> /home/$MY_USERNAME/.emacs
141
+    echo '' >> /home/$MY_USERNAME/.emacs
142
+    echo '(mouse-wheel-mode t)' >> /home/$MY_USERNAME/.emacs
143
+    echo '' >> /home/$MY_USERNAME/.emacs
144
+    echo $';; ===== Place Backup Files in Specific Directory =======================' >> /home/$MY_USERNAME/.emacs
145
+    echo '' >> /home/$MY_USERNAME/.emacs
146
+    echo '(setq make-backup-files t)' >> /home/$MY_USERNAME/.emacs
147
+    echo '(setq version-control t)' >> /home/$MY_USERNAME/.emacs
148
+    echo '(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))' >> /home/$MY_USERNAME/.emacs
149
+    echo '' >> /home/$MY_USERNAME/.emacs
150
+    echo $';; ===== Make Text mode the default mode for new buffers ================' >> /home/$MY_USERNAME/.emacs
151
+    echo '' >> /home/$MY_USERNAME/.emacs
152
+    echo "(setq default-major-mode 'text-mode)" >> /home/$MY_USERNAME/.emacs
153
+    echo '' >> /home/$MY_USERNAME/.emacs
154
+    echo $';; ===== Line length ====================================================' >> /home/$MY_USERNAME/.emacs
155
+    echo '' >> /home/$MY_USERNAME/.emacs
156
+    echo '(setq-default fill-column 72)' >> /home/$MY_USERNAME/.emacs
157
+    echo '' >> /home/$MY_USERNAME/.emacs
158
+    echo $';; ===== Enable Line and Column Numbering ===============================' >> /home/$MY_USERNAME/.emacs
159
+    echo '' >> /home/$MY_USERNAME/.emacs
160
+    echo '(line-number-mode 1)' >> /home/$MY_USERNAME/.emacs
161
+    echo '(column-number-mode 1)' >> /home/$MY_USERNAME/.emacs
162
+    echo '' >> /home/$MY_USERNAME/.emacs
163
+    echo $';; ===== Turn on Auto Fill mode automatically in all modes ==============' >> /home/$MY_USERNAME/.emacs
164
+    echo '' >> /home/$MY_USERNAME/.emacs
165
+    echo ';; Auto-fill-mode the the automatic wrapping of lines and insertion of' >> /home/$MY_USERNAME/.emacs
166
+    echo ';; newlines when the cursor goes over the column limit.' >> /home/$MY_USERNAME/.emacs
167
+    echo '' >> /home/$MY_USERNAME/.emacs
168
+    echo ';; This should actually turn on auto-fill-mode by default in all major' >> /home/$MY_USERNAME/.emacs
169
+    echo ';; modes. The other way to do this is to turn on the fill for specific modes' >> /home/$MY_USERNAME/.emacs
170
+    echo ';; via hooks.' >> /home/$MY_USERNAME/.emacs
171
+    echo '' >> /home/$MY_USERNAME/.emacs
172
+    echo '(setq auto-fill-mode 1)' >> /home/$MY_USERNAME/.emacs
173
+    echo '' >> /home/$MY_USERNAME/.emacs
174
+    echo $';; ===== Enable GPG encryption =========================================' >> /home/$MY_USERNAME/.emacs
175
+    echo '' >> /home/$MY_USERNAME/.emacs
176
+    echo "(require 'epa)" >> /home/$MY_USERNAME/.emacs
177
+    echo '(epa-file-enable)' >> /home/$MY_USERNAME/.emacs
178
+    cp /home/$MY_USERNAME/.emacs /root/.emacs
179
+    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
180 180
 
181
-	echo 'install_emacs' >> $COMPLETION_FILE
181
+    echo 'install_emacs' >> $COMPLETION_FILE
182 182
 }
183 183
 
184 184
 # NOTE: deliberately no exit 0

+ 260
- 260
src/freedombone-app-syncthing Dosyayı Görüntüle

@@ -40,295 +40,295 @@ SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared
40 40
 SYNCTHING_USER_IDS_FILE='.syncthingids'
41 41
 
42 42
 function reconfigure_syncthing {
43
-	echo -n ''
43
+    echo -n ''
44 44
 }
45 45
 
46 46
 function upgrade_syncthing {
47
-	echo -n ''
47
+    echo -n ''
48 48
 }
49 49
 
50 50
 function backup_local_syncthing {
51
-	if [ -d /var/lib/syncthing/SyncShared ]; then
52
-		echo $"Backing up syncthing"
51
+    if [ -d /var/lib/syncthing/SyncShared ]; then
52
+        echo $"Backing up syncthing"
53 53
 
54
-		function_check backup_directory_to_usb
55
-		backup_directory_to_usb /var/lib/syncthing/SyncShared syncthingshared
56
-		backup_directory_to_usb /root/.config/syncthing syncthingconfig
54
+        function_check backup_directory_to_usb
55
+        backup_directory_to_usb /var/lib/syncthing/SyncShared syncthingshared
56
+        backup_directory_to_usb /root/.config/syncthing syncthingconfig
57 57
 
58
-		echo $"Backup to syncthing complete"
59
-	fi
58
+        echo $"Backup to syncthing complete"
59
+    fi
60 60
 }
61 61
 
62 62
 function restore_local_syncthing {
63
-	if [ -f /etc/systemd/system/syncthing.service ]; then
64
-		systemctl stop syncthing
65
-		systemctl stop cron
66
-	fi
67
-
68
-	temp_restore_dir=/root/tempsyncthing
69
-	if [ -d $USB_MOUNT/backup/syncthingconfig ]; then
70
-		echo $"Restoring syncthing configuration"
71
-		function_check restore_directory_from_usb
72
-		restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
73
-		cp -r ${temp_restore_dir}config/* /
74
-		if [ ! "$?" = "0" ]; then
75
-			set_user_permissions
76
-			backup_unmount_drive
77
-			systemctl start syncthing
78
-			systemctl start cron
79
-			exit 6833
80
-		fi
81
-		rm -rf ${temp_restore_dir}config
82
-	fi
83
-
84
-	if [ -d $USB_MOUNT/backup/syncthingshared ]; then
85
-		echo $"Restoring syncthing shared files"
86
-		restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
87
-		cp -r ${temp_restore_dir}shared/* /
88
-		if [ ! "$?" = "0" ]; then
89
-			set_user_permissions
90
-			backup_unmount_drive
91
-			systemctl start syncthing
92
-			systemctl start cron
93
-			exit 37904
94
-		fi
95
-		rm -rf ${temp_restore_dir}shared
96
-	fi
97
-
98
-	if [ -d $USB_MOUNT/backup/syncthing ]; then
99
-		for d in $USB_MOUNT/backup/syncthing/*/ ; do
100
-			USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
101
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
102
-				if [ ! -d /home/$USERNAME ]; then
103
-					${PROJECT_NAME}-adduser $USERNAME
104
-				fi
105
-				echo $"Restoring syncthing files for $USERNAME"
106
-				restore_directory_from_usb ${temp_restore_dir} syncthing/$USERNAME
107
-				cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
108
-				if [ ! "$?" = "0" ]; then
109
-					rm -rf ${temp_restore_dir}
110
-					set_user_permissions
111
-					backup_unmount_drive
112
-					systemctl start syncthing
113
-					systemctl start cron
114
-					exit 68438
115
-				fi
116
-				rm -rf ${temp_restore_dir}
117
-
118
-				# restore device IDs from config settings
119
-				if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
120
-					cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
121
-					chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
122
-				fi
123
-				if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
124
-					cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
125
-					chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
126
-				fi
127
-			fi
128
-		done
129
-	fi
130
-
131
-	if [ -f /etc/systemd/system/syncthing.service ]; then
132
-		systemctl start syncthing
133
-		systemctl start cron
134
-	fi
63
+    if [ -f /etc/systemd/system/syncthing.service ]; then
64
+        systemctl stop syncthing
65
+        systemctl stop cron
66
+    fi
67
+
68
+    temp_restore_dir=/root/tempsyncthing
69
+    if [ -d $USB_MOUNT/backup/syncthingconfig ]; then
70
+        echo $"Restoring syncthing configuration"
71
+        function_check restore_directory_from_usb
72
+        restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
73
+        cp -r ${temp_restore_dir}config/* /
74
+        if [ ! "$?" = "0" ]; then
75
+            set_user_permissions
76
+            backup_unmount_drive
77
+            systemctl start syncthing
78
+            systemctl start cron
79
+            exit 6833
80
+        fi
81
+        rm -rf ${temp_restore_dir}config
82
+    fi
83
+
84
+    if [ -d $USB_MOUNT/backup/syncthingshared ]; then
85
+        echo $"Restoring syncthing shared files"
86
+        restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
87
+        cp -r ${temp_restore_dir}shared/* /
88
+        if [ ! "$?" = "0" ]; then
89
+            set_user_permissions
90
+            backup_unmount_drive
91
+            systemctl start syncthing
92
+            systemctl start cron
93
+            exit 37904
94
+        fi
95
+        rm -rf ${temp_restore_dir}shared
96
+    fi
97
+
98
+    if [ -d $USB_MOUNT/backup/syncthing ]; then
99
+        for d in $USB_MOUNT/backup/syncthing/*/ ; do
100
+            USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
101
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
102
+                if [ ! -d /home/$USERNAME ]; then
103
+                    ${PROJECT_NAME}-adduser $USERNAME
104
+                fi
105
+                echo $"Restoring syncthing files for $USERNAME"
106
+                restore_directory_from_usb ${temp_restore_dir} syncthing/$USERNAME
107
+                cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
108
+                if [ ! "$?" = "0" ]; then
109
+                    rm -rf ${temp_restore_dir}
110
+                    set_user_permissions
111
+                    backup_unmount_drive
112
+                    systemctl start syncthing
113
+                    systemctl start cron
114
+                    exit 68438
115
+                fi
116
+                rm -rf ${temp_restore_dir}
117
+
118
+                # restore device IDs from config settings
119
+                if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
120
+                    cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
121
+                    chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
122
+                fi
123
+                if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
124
+                    cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
125
+                    chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
126
+                fi
127
+            fi
128
+        done
129
+    fi
130
+
131
+    if [ -f /etc/systemd/system/syncthing.service ]; then
132
+        systemctl start syncthing
133
+        systemctl start cron
134
+    fi
135 135
 }
136 136
 
137 137
 function backup_remote_syncthing {
138
-	if [ -d /root/.config/syncthing ]; then
139
-		echo $"Backing up syncthing configuration"
140
-		function_check backup_directory_to_friend
141
-		backup_directory_to_friend /root/.config/syncthing syncthingconfig
142
-		echo $"Backup of syncthing configuration complete"
143
-	fi
144
-	if [ -d /var/lib/syncthing/SyncShared ]; then
145
-		echo $"Backing up syncthing shared files"
146
-		function_check backup_directory_to_friend
147
-		backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
148
-		echo $"Backup of syncthing shared files complete"
149
-	fi
138
+    if [ -d /root/.config/syncthing ]; then
139
+        echo $"Backing up syncthing configuration"
140
+        function_check backup_directory_to_friend
141
+        backup_directory_to_friend /root/.config/syncthing syncthingconfig
142
+        echo $"Backup of syncthing configuration complete"
143
+    fi
144
+    if [ -d /var/lib/syncthing/SyncShared ]; then
145
+        echo $"Backing up syncthing shared files"
146
+        function_check backup_directory_to_friend
147
+        backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
148
+        echo $"Backup of syncthing shared files complete"
149
+    fi
150 150
 }
151 151
 
152 152
 function restore_remote_syncthing {
153
-	if [ -f /etc/systemd/system/syncthing.service ]; then
154
-		systemctl stop syncthing
155
-		systemctl stop cron
156
-	fi
157
-
158
-	if [ -d $SERVER_DIRECTORY/backup/syncthingconfig ]; then
159
-		echo $"Restoring syncthing configuration"
160
-		temp_restore_dir=/root/tempsyncthingconfig
161
-		function_check restore_directory_from_friend
162
-		restore_directory_from_friend $temp_restore_dir syncthingconfig
163
-		cp -r $temp_restore_dir/* /
164
-		if [ ! "$?" = "0" ]; then
165
-			systemctl start syncthing
166
-			systemctl start cron
167
-			exit 6833
168
-		fi
169
-		rm -rf $temp_restore_dir
170
-	fi
171
-
172
-	if [ -d $SERVER_DIRECTORY/backup/syncthingshared ]; then
173
-		echo $"Restoring syncthing shared files"
174
-		temp_restore_dir=/root/tempsyncthingshared
175
-		function_check restore_directory_from_friend
176
-		restore_directory_from_friend $temp_restore_dir syncthingshared
177
-		cp -r $temp_restore_dir/* /
178
-		if [ ! "$?" = "0" ]; then
179
-			systemctl start syncthing
180
-			systemctl start cron
181
-			exit 37904
182
-		fi
183
-		rm -rf $temp_restore_dir
184
-	fi
185
-
186
-	if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
187
-		for d in $SERVER_DIRECTORY/backup/syncthing/*/ ; do
188
-			USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
189
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
190
-				if [ ! -d /home/$USERNAME ]; then
191
-					${PROJECT_NAME}-adduser $USERNAME
192
-				fi
193
-				echo $"Restoring syncthing files for $USERNAME"
194
-				temp_restore_dir=/root/tempsyncthing
195
-				function_check restore_directory_from_friend
196
-				restore_directory_from_friend $temp_restore_dir syncthing/$USERNAME
197
-				cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
198
-				if [ ! "$?" = "0" ]; then
199
-					rm -rf $temp_restore_dir
200
-					systemctl start syncthing
201
-					systemctl start cron
202
-					exit 68438
203
-				fi
204
-				rm -rf $temp_restore_dir
205
-
206
-				# restore device IDs from config settings
207
-				if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
208
-					cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
209
-					chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
210
-				fi
211
-				if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
212
-					cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
213
-					chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
214
-				fi
215
-				echo $"Restore of syncthing files for $USERNAME complete"
216
-			fi
217
-		done
218
-	fi
219
-
220
-	if [ -f /etc/systemd/system/syncthing.service ]; then
221
-		systemctl start syncthing
222
-		systemctl start cron
223
-	fi
153
+    if [ -f /etc/systemd/system/syncthing.service ]; then
154
+        systemctl stop syncthing
155
+        systemctl stop cron
156
+    fi
157
+
158
+    if [ -d $SERVER_DIRECTORY/backup/syncthingconfig ]; then
159
+        echo $"Restoring syncthing configuration"
160
+        temp_restore_dir=/root/tempsyncthingconfig
161
+        function_check restore_directory_from_friend
162
+        restore_directory_from_friend $temp_restore_dir syncthingconfig
163
+        cp -r $temp_restore_dir/* /
164
+        if [ ! "$?" = "0" ]; then
165
+            systemctl start syncthing
166
+            systemctl start cron
167
+            exit 6833
168
+        fi
169
+        rm -rf $temp_restore_dir
170
+    fi
171
+
172
+    if [ -d $SERVER_DIRECTORY/backup/syncthingshared ]; then
173
+        echo $"Restoring syncthing shared files"
174
+        temp_restore_dir=/root/tempsyncthingshared
175
+        function_check restore_directory_from_friend
176
+        restore_directory_from_friend $temp_restore_dir syncthingshared
177
+        cp -r $temp_restore_dir/* /
178
+        if [ ! "$?" = "0" ]; then
179
+            systemctl start syncthing
180
+            systemctl start cron
181
+            exit 37904
182
+        fi
183
+        rm -rf $temp_restore_dir
184
+    fi
185
+
186
+    if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
187
+        for d in $SERVER_DIRECTORY/backup/syncthing/*/ ; do
188
+            USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
189
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
190
+                if [ ! -d /home/$USERNAME ]; then
191
+                    ${PROJECT_NAME}-adduser $USERNAME
192
+                fi
193
+                echo $"Restoring syncthing files for $USERNAME"
194
+                temp_restore_dir=/root/tempsyncthing
195
+                function_check restore_directory_from_friend
196
+                restore_directory_from_friend $temp_restore_dir syncthing/$USERNAME
197
+                cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
198
+                if [ ! "$?" = "0" ]; then
199
+                    rm -rf $temp_restore_dir
200
+                    systemctl start syncthing
201
+                    systemctl start cron
202
+                    exit 68438
203
+                fi
204
+                rm -rf $temp_restore_dir
205
+
206
+                # restore device IDs from config settings
207
+                if [ -f /home/$USERNAME/.config/syncthing/.syncthing-server-id ]; then
208
+                    cp /home/$USERNAME/.config/syncthing/.syncthing-server-id /home/$USERNAME/.syncthing-server-id
209
+                    chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
210
+                fi
211
+                if [ -f /home/$USERNAME/.config/syncthing/.syncthingids ]; then
212
+                    cp /home/$USERNAME/.config/syncthing/.syncthingids /home/$USERNAME/.syncthingids
213
+                    chown $USERNAME:$USERNAME /home/$USERNAME/.syncthingids
214
+                fi
215
+                echo $"Restore of syncthing files for $USERNAME complete"
216
+            fi
217
+        done
218
+    fi
219
+
220
+    if [ -f /etc/systemd/system/syncthing.service ]; then
221
+        systemctl start syncthing
222
+        systemctl start cron
223
+    fi
224 224
 }
225 225
 
226 226
 function remove_syncthing {
227
-	if ! grep -Fxq "install_syncthing" $COMPLETION_FILE; then
228
-		return
229
-	fi
230
-	iptables -D INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
231
-	iptables -D INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
232
-	function_check save_firewall_settings
233
-	save_firewall_settings
234
-
235
-	systemctl stop syncthing
236
-	systemctl disable syncthing
237
-	apt-get -y remove --purge syncthing
238
-	rm /etc/systemd/system/syncthing.service
239
-	sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
240
-	sed -i '/install_syncthing/d' $COMPLETION_FILE
241
-	sed -i '/configure_firewall_for_syncthing/d' $COMPLETION_FILE
242
-	systemctl restart cron
227
+    if ! grep -Fxq "install_syncthing" $COMPLETION_FILE; then
228
+        return
229
+    fi
230
+    iptables -D INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
231
+    iptables -D INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
232
+    function_check save_firewall_settings
233
+    save_firewall_settings
234
+
235
+    systemctl stop syncthing
236
+    systemctl disable syncthing
237
+    apt-get -y remove --purge syncthing
238
+    rm /etc/systemd/system/syncthing.service
239
+    sed -i "/${PROJECT_NAME}-syncthing/d" /etc/crontab
240
+    sed -i '/install_syncthing/d' $COMPLETION_FILE
241
+    sed -i '/configure_firewall_for_syncthing/d' $COMPLETION_FILE
242
+    systemctl restart cron
243 243
 }
244 244
 
245 245
 function configure_firewall_for_syncthing {
246
-	if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
247
-		return
248
-	fi
249
-	iptables -A INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
250
-	iptables -A INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
251
-	function_check save_firewall_settings
252
-	save_firewall_settings
253
-
254
-	OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
255
-	echo 'configure_firewall_for_syncthing' >> $COMPLETION_FILE
246
+    if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
247
+        return
248
+    fi
249
+    iptables -A INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
250
+    iptables -A INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
251
+    function_check save_firewall_settings
252
+    save_firewall_settings
253
+
254
+    OPEN_PORTS+=("Syncthing $SYNCTHING_PORT")
255
+    echo 'configure_firewall_for_syncthing' >> $COMPLETION_FILE
256 256
 }
257 257
 
258 258
 function mesh_install_syncthing {
259
-	chroot "$rootdir" wget -q https://syncthing.net/release-key.txt -O- | apt-key add -
260
-
261
-	echo "deb http://apt.syncthing.net/ syncthing release" | tee $rootdir/etc/apt/sources.list.d/syncthing.list
262
-	chroot "$rootdir" apt-get update
263
-	chroot "$rootdir" apt-get -y --force-yes install syncthing
264
-
265
-	# This probably does need to run as root so that it can access the Sync directories
266
-	# in each user's home directory
267
-	echo '[Unit]' > $rootdir/etc/systemd/system/syncthing.service
268
-	echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> $rootdir/etc/systemd/system/syncthing.service
269
-	echo 'Documentation=man:syncthing(1)' >> $rootdir/etc/systemd/system/syncthing.service
270
-	echo 'After=network.target' >> $rootdir/etc/systemd/system/syncthing.service
271
-	echo 'Wants=syncthing-inotify@.service' >> $rootdir/etc/systemd/system/syncthing.service
272
-	echo '' >> $rootdir/etc/systemd/system/syncthing.service
273
-	echo '[Service]' >> $rootdir/etc/systemd/system/syncthing.service
274
-	echo 'User=root' >> $rootdir/etc/systemd/system/syncthing.service
275
-	echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> $rootdir/etc/systemd/system/syncthing.service
276
-	echo 'Restart=on-failure' >> $rootdir/etc/systemd/system/syncthing.service
277
-	echo 'SuccessExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
278
-	echo 'RestartForceExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
279
-	echo '' >> $rootdir/etc/systemd/system/syncthing.service
280
-	echo '[Install]' >> $rootdir/etc/systemd/system/syncthing.service
281
-	echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/syncthing.service
282
-	chroot "$rootdir" systemctl enable syncthing
283
-
284
-	echo 'mesh_install_syncthing'
259
+    chroot "$rootdir" wget -q https://syncthing.net/release-key.txt -O- | apt-key add -
260
+
261
+    echo "deb http://apt.syncthing.net/ syncthing release" | tee $rootdir/etc/apt/sources.list.d/syncthing.list
262
+    chroot "$rootdir" apt-get update
263
+    chroot "$rootdir" apt-get -y --force-yes install syncthing
264
+
265
+    # This probably does need to run as root so that it can access the Sync directories
266
+    # in each user's home directory
267
+    echo '[Unit]' > $rootdir/etc/systemd/system/syncthing.service
268
+    echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> $rootdir/etc/systemd/system/syncthing.service
269
+    echo 'Documentation=man:syncthing(1)' >> $rootdir/etc/systemd/system/syncthing.service
270
+    echo 'After=network.target' >> $rootdir/etc/systemd/system/syncthing.service
271
+    echo 'Wants=syncthing-inotify@.service' >> $rootdir/etc/systemd/system/syncthing.service
272
+    echo '' >> $rootdir/etc/systemd/system/syncthing.service
273
+    echo '[Service]' >> $rootdir/etc/systemd/system/syncthing.service
274
+    echo 'User=root' >> $rootdir/etc/systemd/system/syncthing.service
275
+    echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> $rootdir/etc/systemd/system/syncthing.service
276
+    echo 'Restart=on-failure' >> $rootdir/etc/systemd/system/syncthing.service
277
+    echo 'SuccessExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
278
+    echo 'RestartForceExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
279
+    echo '' >> $rootdir/etc/systemd/system/syncthing.service
280
+    echo '[Install]' >> $rootdir/etc/systemd/system/syncthing.service
281
+    echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/syncthing.service
282
+    chroot "$rootdir" systemctl enable syncthing
283
+
284
+    echo 'mesh_install_syncthing'
285 285
 }
286 286
 
287 287
 function install_syncthing {
288
-	if [ $INSTALLING_MESH ]; then
289
-		mesh_install_syncthing
290
-		return
291
-	fi
292
-
293
-	if grep -Fxq "install_syncthing" $COMPLETION_FILE; then
294
-		return
295
-	fi
296
-
297
-	apt-get -y install curl
298
-
299
-	curl -s https://syncthing.net/release-key.txt | apt-key add -
300
-	echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
301
-	apt-get update
302
-	apt-get -y install syncthing
303
-
304
-	# This probably does need to run as root so that it can access the Sync directories
305
-	# in each user's home directory
306
-	echo '[Unit]' > /etc/systemd/system/syncthing.service
307
-	echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service
308
-	echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service
309
-	echo 'After=network.target' >> /etc/systemd/system/syncthing.service
310
-	echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service
311
-	echo '' >> /etc/systemd/system/syncthing.service
312
-	echo '[Service]' >> /etc/systemd/system/syncthing.service
313
-	echo 'User=root' >> /etc/systemd/system/syncthing.service
314
-	echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service
315
-	echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service
316
-	echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service
317
-	echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service
318
-	echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service
319
-	echo '' >> /etc/systemd/system/syncthing.service
320
-	echo '[Install]' >> /etc/systemd/system/syncthing.service
321
-	echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service
322
-	systemctl enable syncthing
323
-	systemctl daemon-reload
324
-	systemctl start syncthing
325
-
326
-	function_check cron_add_mins
327
-	cron_add_mins 1 "/usr/local/bin/${PROJECT_NAME}-syncthing > /dev/null"
328
-
329
-	function_check configure_firewall_for_syncthing
330
-	configure_firewall_for_syncthing
331
-	echo 'install_syncthing' >> $COMPLETION_FILE
288
+    if [ $INSTALLING_MESH ]; then
289
+        mesh_install_syncthing
290
+        return
291
+    fi
292
+
293
+    if grep -Fxq "install_syncthing" $COMPLETION_FILE; then
294
+        return
295
+    fi
296
+
297
+    apt-get -y install curl
298
+
299
+    curl -s https://syncthing.net/release-key.txt | apt-key add -
300
+    echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
301
+    apt-get update
302
+    apt-get -y install syncthing
303
+
304
+    # This probably does need to run as root so that it can access the Sync directories
305
+    # in each user's home directory
306
+    echo '[Unit]' > /etc/systemd/system/syncthing.service
307
+    echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service
308
+    echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service
309
+    echo 'After=network.target' >> /etc/systemd/system/syncthing.service
310
+    echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service
311
+    echo '' >> /etc/systemd/system/syncthing.service
312
+    echo '[Service]' >> /etc/systemd/system/syncthing.service
313
+    echo 'User=root' >> /etc/systemd/system/syncthing.service
314
+    echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service
315
+    echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service
316
+    echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service
317
+    echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service
318
+    echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service
319
+    echo '' >> /etc/systemd/system/syncthing.service
320
+    echo '[Install]' >> /etc/systemd/system/syncthing.service
321
+    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service
322
+    systemctl enable syncthing
323
+    systemctl daemon-reload
324
+    systemctl start syncthing
325
+
326
+    function_check cron_add_mins
327
+    cron_add_mins 1 "/usr/local/bin/${PROJECT_NAME}-syncthing > /dev/null"
328
+
329
+    function_check configure_firewall_for_syncthing
330
+    configure_firewall_for_syncthing
331
+    echo 'install_syncthing' >> $COMPLETION_FILE
332 332
 }
333 333
 
334 334
 # NOTE: deliberately no exit 0

+ 56
- 8
src/freedombone-app-tahoelafs Dosyayı Görüntüle

@@ -28,7 +28,7 @@
28 28
 # You should have received a copy of the GNU Affero General Public License
29 29
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
30 30
 
31
-VARIANTS='mesh'
31
+VARIANTS='full mesh'
32 32
 
33 33
 TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
34 34
 TAHOELAFS_COMMIT='30b421d48b3d1dae2ef507bf27a1f3816300cd92'
@@ -42,7 +42,7 @@ TAHOE_COMMAND="cd /var/lib/tahoelafs && venv/bin/tahoe"
42 42
 function reconfigure_tahoelafs {
43 43
     for d in /home/*/ ; do
44 44
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
45
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
45
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
46 46
             if [ -d /home/$USERNAME/.tahoe ]; then
47 47
                 su -c "$TAHOE_COMMAND stop" - $USERNAME
48 48
                 rm -rf /home/$USERNAME/.tahoe
@@ -257,17 +257,65 @@ function install_tahoelafs {
257 257
 
258 258
     apt-get -y install build-essential python-pip python-dev libffi-dev libssl-dev python-virtualenv
259 259
 
260
-    git_clone $TAHOELAFS_REPO /var/lib/tahoelafs
261
-    cd /var/lib/tahoelafs
260
+    # create a user to run the introducer
261
+    if [ ! -d /home/tahoelafs ]; then
262
+        # add a gogs user account
263
+        adduser --disabled-login --gecos 'tahoe-lafs' tahoelafs
264
+    fi
265
+
266
+    if [ -d /home/tahoelafs/Maildir ]; then
267
+        rm -rf /home/tahoelafs/Maildir
268
+    fi
269
+
270
+    if [ ! -d /home/tahoelafs/.tahoe-introducer ]; then
271
+        mkdir /home/tahoelafs/.tahoe-introducer
272
+    fi
273
+
274
+    git_clone $TAHOELAFS_REPO /home/tahoelafs/tahoelafs
275
+    cd /home/tahoelafs/tahoelafs
262 276
     git checkout $TAHOELAFS_COMMIT -b $TAHOELAFS_COMMIT
263 277
     virtualenv venv
264 278
     venv/bin/pip install --editable .
265 279
     configure_firewall_for_tahoelafs
266
-    reconfigure_tahoelafs
267
-    tahoelafs_update_script /usr/bin/update-tahoelafs
268 280
 
269
-    function_check cron_add_mins
270
-    cron_add_mins 1 "/usr/bin/update-tahoelafs 2> /dev/null"
281
+    su -c "cd $TAHOE_COMMAND create-introducer /home/tahoelafs/.tahoe-introducer" - tahoelafs
282
+    TAHOELAFS_CONFIG=/home/tahoelafs/.tahoe-introducer/tahoe.cfg
283
+    if [ ! -f $TAHOELAFS_CONFIG ]; then
284
+        exit 62831
285
+    fi
286
+
287
+    sed -i "s|nickname =.*|nickname = $HOSTNAME|g" $TAHOELAFS_CONFIG
288
+
289
+    if ! grep -q "[storage]" $TAHOELAFS_CONFIG; then
290
+        echo '' >> $TAHOELAFS_CONFIG
291
+        echo '[storage]' >> $TAHOELAFS_CONFIG
292
+        echo 'enabled = true' >> $TAHOELAFS_CONFIG
293
+        echo "reserved_space = $TAHOELAFS_STORAGE_SPACE" >> $TAHOELAFS_CONFIG
294
+    fi
295
+
296
+    chown -R tahoelafs:tahoelafs /home/tahoelafs
297
+
298
+    TAHOELAFS_DAEMON_FILE=/etc/systemd/system/tahoelafs.service
299
+    echo '[Unit]' > $TAHOELAFS_DAEMON_FILE
300
+    echo 'Description=Tahoe-LAFS introducer' >> $TAHOELAFS_DAEMON_FILE
301
+    echo 'After=syslog.target' >> $TAHOELAFS_DAEMON_FILE
302
+    echo 'After=network.target' >> $TAHOELAFS_DAEMON_FILE
303
+    echo '' >> $TAHOELAFS_DAEMON_FILE
304
+    echo '[Service]' >> $TAHOELAFS_DAEMON_FILE
305
+    echo 'Type=simple' >> $TAHOELAFS_DAEMON_FILE
306
+    echo "User=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
307
+    echo "Group=tahoelafs" >> $TAHOELAFS_DAEMON_FILE
308
+    echo "WorkingDirectory=/home/tahoelafs" >> $TAHOELAFS_DAEMON_FILE
309
+    echo "ExecStart=venv/bin/tahoe start /home/tahoelafs/.tahoe-introducer" >> $TAHOELAFS_DAEMON_FILE
310
+    echo "ExecStop=venv/bin/tahoe stop /home/tahoelafs/.tahoe-introducer" >> $TAHOELAFS_DAEMON_FILE
311
+    echo 'Restart=on-failure' >> $TAHOELAFS_DAEMON_FILE
312
+    echo "Environment=\"USER=tahoelafs\" \"HOME=/home/tahoelafs\"" >> $TAHOELAFS_DAEMON_FILE
313
+    echo '' >> $TAHOELAFS_DAEMON_FILE
314
+    echo '[Install]' >> $TAHOELAFS_DAEMON_FILE
315
+    echo 'WantedBy=multi-user.target' >> $TAHOELAFS_DAEMON_FILE
316
+    systemctl enable tahoelafs
317
+    systemctl daemon-reload
318
+    systemctl start tahoelafs
271 319
 
272 320
     echo 'install_tahoelafs' >> $COMPLETION_FILE
273 321
 }

+ 1
- 1
src/freedombone-app-xmpp Dosyayı Görüntüle

@@ -234,7 +234,7 @@ function remove_xmpp {
234 234
 function xmpp_email_headers {
235 235
     for d in /home/*/ ; do
236 236
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
237
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
237
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
238 238
             if [ -f /home/$USERNAME/.muttrc ]; then
239 239
                 if ! grep -q "Jabber-ID" /home/$USERNAME/.muttrc; then
240 240
                     echo "my_hdr Jabber-ID: ${USERNAME}@${HOSTNAME}" >> /home/$USERNAME/.muttrc

+ 1
- 1
src/freedombone-archive-mail Dosyayı Görüntüle

@@ -35,7 +35,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
35 35
 
36 36
 for d in /home/*/ ; do
37 37
     USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
38
-    if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
38
+    if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
39 39
         # for every user who has a mail directory
40 40
         if [ -d /home/$USERNAME/Maildir ]; then
41 41
             MUTTRC=/home/$USERNAME/.muttrc

+ 292
- 292
src/freedombone-backup-local Dosyayı Görüntüle

@@ -49,9 +49,9 @@ USB_MOUNT=/mnt/usb
49 49
 # get default USB from config file
50 50
 CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
51 51
 if [ -f $CONFIG_FILE ]; then
52
-	if grep -q "USB_DRIVE=" $CONFIG_FILE; then
53
-		USB_DRIVE=$(cat $CONFIG_FILE | grep "USB_DRIVE=" | awk -F '=' '{print $2}')
54
-	fi
52
+    if grep -q "USB_DRIVE=" $CONFIG_FILE; then
53
+        USB_DRIVE=$(cat $CONFIG_FILE | grep "USB_DRIVE=" | awk -F '=' '{print $2}')
54
+    fi
55 55
 fi
56 56
 
57 57
 # get the version of Go being used
@@ -67,333 +67,333 @@ SUSPENDED_SITE=
67 67
 
68 68
 DATABASE_PASSWORD=''
69 69
 if [ -f /root/dbpass ]; then
70
-	DATABASE_PASSWORD=$(cat /root/dbpass)
70
+    DATABASE_PASSWORD=$(cat /root/dbpass)
71 71
 fi
72 72
 
73 73
 function make_backup_directory {
74
-	# make a backup directory on the drive
75
-	if [ ! -d $USB_MOUNT/backup ]; then
76
-		mkdir $USB_MOUNT/backup
77
-	fi
78
-	if [ ! -d $USB_MOUNT/backup ]; then
79
-		echo $"There was a problem making the directory $USB_MOUNT/backup."
80
-		umount $USB_MOUNT
81
-		rm -rf $USB_MOUNT
82
-		exit 3
83
-	fi
74
+    # make a backup directory on the drive
75
+    if [ ! -d $USB_MOUNT/backup ]; then
76
+        mkdir $USB_MOUNT/backup
77
+    fi
78
+    if [ ! -d $USB_MOUNT/backup ]; then
79
+        echo $"There was a problem making the directory $USB_MOUNT/backup."
80
+        umount $USB_MOUNT
81
+        rm -rf $USB_MOUNT
82
+        exit 3
83
+    fi
84 84
 }
85 85
 
86 86
 function check_storage_space_remaining {
87
-	# Check space remaining on the usb drive
88
-	used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}')
89
-	if [ $used_percent -gt 95 ]; then
90
-		echo $"Less than 5% of space remaining on backup drive"
91
-		umount $USB_MOUNT
92
-		rm -rf $USB_MOUNT
93
-		exit 4
94
-	fi
87
+    # Check space remaining on the usb drive
88
+    used_percent=$(df -k $USB_MOUNT | tail -n 1 | awk -F ' ' '{print $5}' | awk -F '%' '{print $1}')
89
+    if [ $used_percent -gt 95 ]; then
90
+        echo $"Less than 5% of space remaining on backup drive"
91
+        umount $USB_MOUNT
92
+        rm -rf $USB_MOUNT
93
+        exit 4
94
+    fi
95 95
 }
96 96
 
97 97
 function backup_users {
98
-	# Backup user files
99
-	for d in /home/*/ ; do
100
-		USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
101
-		if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
102
-
103
-			# Backup any gpg keys
104
-			if [ -d /home/$USERNAME/.gnupg ]; then
105
-				echo $"Backing up gpg keys for $USERNAME"
106
-				backup_directory_to_usb /home/$USERNAME/.gnupg gnupg/$USERNAME
107
-			fi
108
-
109
-			# Backup any personal settings
110
-			if [ -d /home/$USERNAME/personal ]; then
111
-				echo $"Backing up personal settings for $USERNAME"
112
-				backup_directory_to_usb /home/$USERNAME/personal personal/$USERNAME
113
-			fi
114
-
115
-			# Backup ssh keys
116
-			if [ -d /home/$USERNAME/.ssh ]; then
117
-				echo $"Backing up ssh keys for $USERNAME"
118
-				backup_directory_to_usb /home/$USERNAME/.ssh ssh/$USERNAME
119
-			fi
120
-
121
-			# Backup fin database if it exists
122
-			if [ -d /home/$USERNAME/.fin ]; then
123
-				echo $"Backing up fin files for $USERNAME"
124
-				backup_directory_to_usb /home/$USERNAME/.fin fin/$USERNAME
125
-			fi
126
-
127
-			# Backup syncthing
128
-			if [ -d /home/$USERNAME/Sync ]; then
129
-				echo $"Backing up syncthing files for $USERNAME"
130
-				backup_directory_to_usb /home/$USERNAME/Sync syncthing/$USERNAME
131
-				# ensure that device IDs will be backed up as part of user config settings
132
-				if [ ! -d /home/$USERNAME/.config/syncthing ]; then
133
-					mkdir -p /home/$USERNAME/.config/syncthing
134
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
135
-				fi
136
-				if [ -f /home/$USERNAME/.syncthing-server-id ]; then
137
-					cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
138
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
139
-				fi
140
-				if [ -f /home/$USERNAME/.syncthingids ]; then
141
-					cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
142
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
143
-				fi
144
-			fi
145
-
146
-			# Backup emacs
147
-			if [ -d /home/$USERNAME/.emacs.d ]; then
148
-				echo $"Backing up Emacs config for $USERNAME"
149
-				if [ -f /home/$USERNAME/.emacs ]; then
150
-					cp /home/$USERNAME/.emacs /home/$USERNAME/.emacs.d/dotemacs
151
-				fi
152
-				backup_directory_to_usb /home/$USERNAME/.emacs.d config/$USERNAME
153
-			fi
154
-
155
-			# Backup user configs
156
-			if [ -d /home/$USERNAME/.config ]; then
157
-				echo $"Backing up config files for $USERNAME"
158
-				backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
159
-			fi
160
-
161
-			# Backup monkeysphere
162
-			if [ -d /home/$USERNAME/.monkeysphere ]; then
163
-				echo $"Backing up monkeysphere files for $USERNAME"
164
-				backup_directory_to_usb /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
165
-			fi
166
-
167
-			# Backup user local
168
-			if [ -d /home/$USERNAME/.local ]; then
169
-				echo $"Backing up local files for $USERNAME"
170
-				backup_directory_to_usb /home/$USERNAME/.local local/$USERNAME
171
-			fi
172
-
173
-			# Backup mutt
174
-			if [ -f /home/$USERNAME/.muttrc ]; then
175
-				echo $"Backing up Mutt settings for $USERNAME"
176
-				if [ ! -d /home/$USERNAME/tempbackup ]; then
177
-					mkdir -p /home/$USERNAME/tempbackup
178
-				fi
179
-				cp /home/$USERNAME/.muttrc /home/$USERNAME/tempbackup
180
-				if [ -f /etc/Muttrc ]; then
181
-					cp /etc/Muttrc /home/$USERNAME/tempbackup
182
-				fi
183
-				backup_directory_to_usb /home/$USERNAME/tempbackup mutt/$USERNAME
184
-			fi
185
-
186
-			# Backup email
187
-			if [ -d /home/$USERNAME/Maildir ]; then
188
-				echo $"Stopping mail server"
189
-				systemctl stop exim4
190
-				echo $"Creating an email archive for $USERNAME"
191
-				if [ ! -d /root/tempbackupemail/$USERNAME ]; then
192
-					mkdir -p /root/tempbackupemail/$USERNAME
193
-				fi
194
-				tar -czvf /root/tempbackupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
195
-				echo $"Restarting mail server"
196
-				systemctl start exim4
197
-				echo $"Backing up emails for $USERNAME"
198
-				backup_directory_to_usb /root/tempbackupemail/$USERNAME mail/$USERNAME
199
-			fi
200
-
201
-			# Backup spamassassin
202
-			if [ -d /home/$USERNAME/.spamassassin ]; then
203
-				echo $"Backing up spamassassin settings for $USERNAME"
204
-				backup_directory_to_usb /home/$USERNAME/.spamassassin spamassassin/$USERNAME
205
-			fi
206
-
207
-			# Backup procmail
208
-			if [ -f /home/$USERNAME/.procmailrc ]; then
209
-				echo $"Backing up procmail settings for $USERNAME"
210
-				if [ ! -d /home/$USERNAME/tempbackup ]; then
211
-					mkdir -p /home/$USERNAME/tempbackup
212
-				fi
213
-				cp /home/$USERNAME/.procmailrc /home/$USERNAME/tempbackup
214
-				backup_directory_to_usb /home/$USERNAME/tempbackup procmail/$USERNAME
215
-			fi
216
-		fi
217
-	done
98
+    # Backup user files
99
+    for d in /home/*/ ; do
100
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
101
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
102
+
103
+            # Backup any gpg keys
104
+            if [ -d /home/$USERNAME/.gnupg ]; then
105
+                echo $"Backing up gpg keys for $USERNAME"
106
+                backup_directory_to_usb /home/$USERNAME/.gnupg gnupg/$USERNAME
107
+            fi
108
+
109
+            # Backup any personal settings
110
+            if [ -d /home/$USERNAME/personal ]; then
111
+                echo $"Backing up personal settings for $USERNAME"
112
+                backup_directory_to_usb /home/$USERNAME/personal personal/$USERNAME
113
+            fi
114
+
115
+            # Backup ssh keys
116
+            if [ -d /home/$USERNAME/.ssh ]; then
117
+                echo $"Backing up ssh keys for $USERNAME"
118
+                backup_directory_to_usb /home/$USERNAME/.ssh ssh/$USERNAME
119
+            fi
120
+
121
+            # Backup fin database if it exists
122
+            if [ -d /home/$USERNAME/.fin ]; then
123
+                echo $"Backing up fin files for $USERNAME"
124
+                backup_directory_to_usb /home/$USERNAME/.fin fin/$USERNAME
125
+            fi
126
+
127
+            # Backup syncthing
128
+            if [ -d /home/$USERNAME/Sync ]; then
129
+                echo $"Backing up syncthing files for $USERNAME"
130
+                backup_directory_to_usb /home/$USERNAME/Sync syncthing/$USERNAME
131
+                # ensure that device IDs will be backed up as part of user config settings
132
+                if [ ! -d /home/$USERNAME/.config/syncthing ]; then
133
+                    mkdir -p /home/$USERNAME/.config/syncthing
134
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
135
+                fi
136
+                if [ -f /home/$USERNAME/.syncthing-server-id ]; then
137
+                    cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
138
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
139
+                fi
140
+                if [ -f /home/$USERNAME/.syncthingids ]; then
141
+                    cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
142
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
143
+                fi
144
+            fi
145
+
146
+            # Backup emacs
147
+            if [ -d /home/$USERNAME/.emacs.d ]; then
148
+                echo $"Backing up Emacs config for $USERNAME"
149
+                if [ -f /home/$USERNAME/.emacs ]; then
150
+                    cp /home/$USERNAME/.emacs /home/$USERNAME/.emacs.d/dotemacs
151
+                fi
152
+                backup_directory_to_usb /home/$USERNAME/.emacs.d config/$USERNAME
153
+            fi
154
+
155
+            # Backup user configs
156
+            if [ -d /home/$USERNAME/.config ]; then
157
+                echo $"Backing up config files for $USERNAME"
158
+                backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
159
+            fi
160
+
161
+            # Backup monkeysphere
162
+            if [ -d /home/$USERNAME/.monkeysphere ]; then
163
+                echo $"Backing up monkeysphere files for $USERNAME"
164
+                backup_directory_to_usb /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
165
+            fi
166
+
167
+            # Backup user local
168
+            if [ -d /home/$USERNAME/.local ]; then
169
+                echo $"Backing up local files for $USERNAME"
170
+                backup_directory_to_usb /home/$USERNAME/.local local/$USERNAME
171
+            fi
172
+
173
+            # Backup mutt
174
+            if [ -f /home/$USERNAME/.muttrc ]; then
175
+                echo $"Backing up Mutt settings for $USERNAME"
176
+                if [ ! -d /home/$USERNAME/tempbackup ]; then
177
+                    mkdir -p /home/$USERNAME/tempbackup
178
+                fi
179
+                cp /home/$USERNAME/.muttrc /home/$USERNAME/tempbackup
180
+                if [ -f /etc/Muttrc ]; then
181
+                    cp /etc/Muttrc /home/$USERNAME/tempbackup
182
+                fi
183
+                backup_directory_to_usb /home/$USERNAME/tempbackup mutt/$USERNAME
184
+            fi
185
+
186
+            # Backup email
187
+            if [ -d /home/$USERNAME/Maildir ]; then
188
+                echo $"Stopping mail server"
189
+                systemctl stop exim4
190
+                echo $"Creating an email archive for $USERNAME"
191
+                if [ ! -d /root/tempbackupemail/$USERNAME ]; then
192
+                    mkdir -p /root/tempbackupemail/$USERNAME
193
+                fi
194
+                tar -czvf /root/tempbackupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
195
+                echo $"Restarting mail server"
196
+                systemctl start exim4
197
+                echo $"Backing up emails for $USERNAME"
198
+                backup_directory_to_usb /root/tempbackupemail/$USERNAME mail/$USERNAME
199
+            fi
200
+
201
+            # Backup spamassassin
202
+            if [ -d /home/$USERNAME/.spamassassin ]; then
203
+                echo $"Backing up spamassassin settings for $USERNAME"
204
+                backup_directory_to_usb /home/$USERNAME/.spamassassin spamassassin/$USERNAME
205
+            fi
206
+
207
+            # Backup procmail
208
+            if [ -f /home/$USERNAME/.procmailrc ]; then
209
+                echo $"Backing up procmail settings for $USERNAME"
210
+                if [ ! -d /home/$USERNAME/tempbackup ]; then
211
+                    mkdir -p /home/$USERNAME/tempbackup
212
+                fi
213
+                cp /home/$USERNAME/.procmailrc /home/$USERNAME/tempbackup
214
+                backup_directory_to_usb /home/$USERNAME/tempbackup procmail/$USERNAME
215
+            fi
216
+        fi
217
+    done
218 218
 }
219 219
 
220 220
 function backup_directories {
221
-	export GVM_ROOT=$GVM_HOME
222
-	if [ -d $GVM_ROOT/bin ]; then
223
-		cd $GVM_ROOT/bin
224
-		[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
225
-		gvm use go${GO_VERSION} --default
226
-		systemctl set-environment GOPATH=$GOPATH
227
-	fi
228
-
229
-	# directories to be backed up (source,dest)
230
-	backup_dirs=(
231
-		"/etc/letsencrypt,                      letsencrypt"
232
-		"/etc/ssl,                              ssl"
233
-		"/var/spool/mlmmj,                      mailinglist"
234
-		"/etc/nginx/sites-available,            web"
235
-		"/var/lib/tor,                          tor"
236
-	)
237
-
238
-	for dr in "${backup_dirs[@]}"
239
-	do
240
-		# if this directory exists then back it up to the given destination
241
-		source_directory=$(echo $dr | awk -F ',' '{print $1}'  | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
242
-		if [ -d $source_directory ]; then
243
-			dest_directory=$(echo $dr | awk -F ',' '{print $2}'  | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
244
-			echo $"Backing up $source_directory to $dest_directory"
245
-			backup_directory_to_usb $source_directory $dest_directory
246
-		fi
247
-
248
-		restart_site
249
-	done
221
+    export GVM_ROOT=$GVM_HOME
222
+    if [ -d $GVM_ROOT/bin ]; then
223
+        cd $GVM_ROOT/bin
224
+        [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
225
+        gvm use go${GO_VERSION} --default
226
+        systemctl set-environment GOPATH=$GOPATH
227
+    fi
228
+
229
+    # directories to be backed up (source,dest)
230
+    backup_dirs=(
231
+        "/etc/letsencrypt,                      letsencrypt"
232
+        "/etc/ssl,                              ssl"
233
+        "/var/spool/mlmmj,                      mailinglist"
234
+        "/etc/nginx/sites-available,            web"
235
+        "/var/lib/tor,                          tor"
236
+    )
237
+
238
+    for dr in "${backup_dirs[@]}"
239
+    do
240
+        # if this directory exists then back it up to the given destination
241
+        source_directory=$(echo $dr | awk -F ',' '{print $1}'  | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
242
+        if [ -d $source_directory ]; then
243
+            dest_directory=$(echo $dr | awk -F ',' '{print $2}'  | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
244
+            echo $"Backing up $source_directory to $dest_directory"
245
+            backup_directory_to_usb $source_directory $dest_directory
246
+        fi
247
+
248
+        restart_site
249
+    done
250 250
 }
251 251
 
252 252
 function remove_backup_directory {
253
-	if [ $1 ]; then
254
-		if [[ $1 == "remove" ]]; then
255
-			if [ -d $USB_MOUNT/backup ]; then
256
-				rm -rf $USB_MOUNT/backup
257
-				echo $'Existing backup directory removed'
258
-				backup_unmount_drive
259
-				exit 0
260
-			fi
261
-		fi
262
-	fi
253
+    if [ $1 ]; then
254
+        if [[ $1 == "remove" ]]; then
255
+            if [ -d $USB_MOUNT/backup ]; then
256
+                rm -rf $USB_MOUNT/backup
257
+                echo $'Existing backup directory removed'
258
+                backup_unmount_drive
259
+                exit 0
260
+            fi
261
+        fi
262
+    fi
263 263
 }
264 264
 
265 265
 function prepare_directories {
266
-	export GVM_ROOT=$GVM_HOME
267
-	if [ -d $GVM_ROOT/bin ]; then
268
-		cd $GVM_ROOT/bin
269
-		[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
270
-		gvm use go${GO_VERSION} --default
271
-		systemctl set-environment GOPATH=$GOPATH
272
-	fi
273
-
274
-	# Some miscellaneous preparation for backing up directories
275
-	if [ -d $GOPATH/src/github.com/gogits ]; then
276
-		mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$ADMIN_USERNAME
277
-	fi
278
-	if [ -d /var/lib/tox-bootstrapd ]; then
279
-		cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd
280
-		if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
281
-			rm -rf /var/lib/tox-bootstrapd/Maildir
282
-		fi
283
-	fi
266
+    export GVM_ROOT=$GVM_HOME
267
+    if [ -d $GVM_ROOT/bin ]; then
268
+        cd $GVM_ROOT/bin
269
+        [[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
270
+        gvm use go${GO_VERSION} --default
271
+        systemctl set-environment GOPATH=$GOPATH
272
+    fi
273
+
274
+    # Some miscellaneous preparation for backing up directories
275
+    if [ -d $GOPATH/src/github.com/gogits ]; then
276
+        mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$ADMIN_USERNAME
277
+    fi
278
+    if [ -d /var/lib/tox-bootstrapd ]; then
279
+        cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd
280
+        if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
281
+            rm -rf /var/lib/tox-bootstrapd/Maildir
282
+        fi
283
+    fi
284 284
 }
285 285
 
286 286
 function backup_configuration {
287
-	echo $"Backing up ${PROJECT_NAME} configuration files"
288
-	temp_backup_dir=/root/tempbackupconfig
289
-	if [ ! -d $temp_backup_dir ]; then
290
-		mkdir -p $temp_backup_dir
291
-	fi
292
-	cp -f $CONFIG_FILE $temp_backup_dir
293
-	cp -f $COMPLETION_FILE $temp_backup_dir
294
-	if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
295
-		cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
296
-	fi
297
-	# nginx password hashes
298
-	if [ -f /etc/nginx/.htpasswd ]; then
299
-		cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
300
-	fi
301
-	backup_directory_to_usb $temp_backup_dir config
287
+    echo $"Backing up ${PROJECT_NAME} configuration files"
288
+    temp_backup_dir=/root/tempbackupconfig
289
+    if [ ! -d $temp_backup_dir ]; then
290
+        mkdir -p $temp_backup_dir
291
+    fi
292
+    cp -f $CONFIG_FILE $temp_backup_dir
293
+    cp -f $COMPLETION_FILE $temp_backup_dir
294
+    if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
295
+        cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
296
+    fi
297
+    # nginx password hashes
298
+    if [ -f /etc/nginx/.htpasswd ]; then
299
+        cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
300
+    fi
301
+    backup_directory_to_usb $temp_backup_dir config
302 302
 }
303 303
 
304 304
 function backup_admin_readme {
305
-	if [ -f /home/$ADMIN_USERNAME/README ]; then
306
-		echo $"Backing up README"
307
-		temp_backup_dir=/home/$ADMIN_USERNAME/tempbackup
308
-		if [ ! -d $temp_backup_dir ]; then
309
-			mkdir -p $temp_backup_dir
310
-		fi
311
-		cp -f /home/$ADMIN_USERNAME/README $temp_backup_dir
312
-		backup_directory_to_usb $temp_backup_dir readme
313
-	fi
305
+    if [ -f /home/$ADMIN_USERNAME/README ]; then
306
+        echo $"Backing up README"
307
+        temp_backup_dir=/home/$ADMIN_USERNAME/tempbackup
308
+        if [ ! -d $temp_backup_dir ]; then
309
+            mkdir -p $temp_backup_dir
310
+        fi
311
+        cp -f /home/$ADMIN_USERNAME/README $temp_backup_dir
312
+        backup_directory_to_usb $temp_backup_dir readme
313
+    fi
314 314
 }
315 315
 
316 316
 function backup_mariadb {
317
-	if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
318
-		temp_backup_dir=/root/tempmariadb
319
-		if [ ! -d $temp_backup_dir ]; then
320
-			mkdir $temp_backup_dir
321
-		fi
322
-		mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql
323
-		if [ ! -s $temp_backup_dir/mysql.sql ]; then
324
-			echo $"Unable to backup mysql settings"
325
-			rm -rf $temp_backup_dir
326
-			umount $USB_MOUNT
327
-			rm -rf $USB_MOUNT
328
-			exit 8
329
-		fi
330
-		echo "$DATABASE_PASSWORD" > $temp_backup_dir/db
331
-		chmod 400 $temp_backup_dir/db
332
-		backup_directory_to_usb $temp_backup_dir mariadb
333
-	fi
317
+    if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
318
+        temp_backup_dir=/root/tempmariadb
319
+        if [ ! -d $temp_backup_dir ]; then
320
+            mkdir $temp_backup_dir
321
+        fi
322
+        mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql
323
+        if [ ! -s $temp_backup_dir/mysql.sql ]; then
324
+            echo $"Unable to backup mysql settings"
325
+            rm -rf $temp_backup_dir
326
+            umount $USB_MOUNT
327
+            rm -rf $USB_MOUNT
328
+            exit 8
329
+        fi
330
+        echo "$DATABASE_PASSWORD" > $temp_backup_dir/db
331
+        chmod 400 $temp_backup_dir/db
332
+        backup_directory_to_usb $temp_backup_dir mariadb
333
+    fi
334 334
 }
335 335
 
336 336
 function valid_backup_destination {
337
-	destination_dir="$1"
338
-	is_valid="yes"
339
-
340
-	if [[ "$destination_dir" == "hubzilla" || \
341
-				"$destination_dir" == "hubzilladata" || \
342
-				"$destination_dir" == "gogs" || \
343
-				"$destination_dir" == "gogsrepos" || \
344
-				"$destination_dir" == "gogsssh" || \
345
-				"$destination_dir" == "gnusocial" || \
346
-				"$destination_dir" == "gnusocialdata" || \
347
-				"$destination_dir" == "mariadb" || \
348
-				"$destination_dir" == "config" || \
349
-				"$destination_dir" == "letsencrypt" || \
350
-				"$destination_dir" == "wiki" || \
351
-				"$destination_dir" == "wiki2" || \
352
-				"$destination_dir" == "xmpp" || \
353
-				"$destination_dir" == "ipfs" || \
354
-				"$destination_dir" == "dlna" || \
355
-				"$destination_dir" == "tox" || \
356
-				"$destination_dir" == "ssl" || \
357
-				"$destination_dir" == "ttrss" || \
358
-				"$destination_dir" == "blog" || \
359
-				"$destination_dir" == "syncthingconfig" || \
360
-				"$destination_dir" == "syncthingshared" || \
361
-				"$destination_dir" == "syncthing" || \
362
-				"$destination_dir" == "mediagoblin" || \
363
-				"$destination_dir" == "mailinglist" ]]; then
364
-		is_valid="no"
365
-	fi
366
-
367
-	echo $is_valid
337
+    destination_dir="$1"
338
+    is_valid="yes"
339
+
340
+    if [[ "$destination_dir" == "hubzilla" || \
341
+                "$destination_dir" == "hubzilladata" || \
342
+                "$destination_dir" == "gogs" || \
343
+                "$destination_dir" == "gogsrepos" || \
344
+                "$destination_dir" == "gogsssh" || \
345
+                "$destination_dir" == "gnusocial" || \
346
+                "$destination_dir" == "gnusocialdata" || \
347
+                "$destination_dir" == "mariadb" || \
348
+                "$destination_dir" == "config" || \
349
+                "$destination_dir" == "letsencrypt" || \
350
+                "$destination_dir" == "wiki" || \
351
+                "$destination_dir" == "wiki2" || \
352
+                "$destination_dir" == "xmpp" || \
353
+                "$destination_dir" == "ipfs" || \
354
+                "$destination_dir" == "dlna" || \
355
+                "$destination_dir" == "tox" || \
356
+                "$destination_dir" == "ssl" || \
357
+                "$destination_dir" == "ttrss" || \
358
+                "$destination_dir" == "blog" || \
359
+                "$destination_dir" == "syncthingconfig" || \
360
+                "$destination_dir" == "syncthingshared" || \
361
+                "$destination_dir" == "syncthing" || \
362
+                "$destination_dir" == "mediagoblin" || \
363
+                "$destination_dir" == "mailinglist" ]]; then
364
+        is_valid="no"
365
+    fi
366
+
367
+    echo $is_valid
368 368
 }
369 369
 
370 370
 function backup_extra_directories {
371
-	if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
372
-		return
373
-	fi
374
-
375
-	echo $"Backing up some additional directories"
376
-	while read backup_line
377
-	do
378
-		backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
379
-		if [ -d "$backup_dir" ]; then
380
-			destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
381
-			if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
382
-				backup_directory_to_usb "$backup_dir" "$destination_dir"
383
-			else
384
-				echo $"WARNING: The backup directory $destination_dir is already used."
385
-				echo $"Choose a different destination name for backing up $backup_dir"
386
-			fi
387
-		else
388
-			echo $"WARNING: Directory $backup_dir does not exist"
389
-		fi
390
-	done <$BACKUP_EXTRA_DIRECTORIES
371
+    if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
372
+        return
373
+    fi
374
+
375
+    echo $"Backing up some additional directories"
376
+    while read backup_line
377
+    do
378
+        backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
379
+        if [ -d "$backup_dir" ]; then
380
+            destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
381
+            if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
382
+                backup_directory_to_usb "$backup_dir" "$destination_dir"
383
+            else
384
+                echo $"WARNING: The backup directory $destination_dir is already used."
385
+                echo $"Choose a different destination name for backing up $backup_dir"
386
+            fi
387
+        else
388
+            echo $"WARNING: Directory $backup_dir does not exist"
389
+        fi
390
+    done <$BACKUP_EXTRA_DIRECTORIES
391 391
 }
392 392
 
393 393
 # has the remove option been set ?
394 394
 remove_option=$2
395 395
 if [[ $1 == "remove" ]]; then
396
-	remove_option=$1
396
+    remove_option=$1
397 397
 fi
398 398
 
399 399
 backup_mount_drive $1 $2

+ 333
- 333
src/freedombone-backup-remote Dosyayı Görüntüle

@@ -54,27 +54,27 @@ ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $
54 54
 ADMIN_NAME=$(getent passwd $ADMIN_USERNAME | cut -d: -f5 | cut -d, -f1)
55 55
 ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
56 56
 if [ ! -f /etc/ssl/private/backup.key ]; then
57
-	echo $"Creating backup key"
58
-	${PROJECT_NAME}-addcert -h backup --dhkey 2048
57
+    echo $"Creating backup key"
58
+    ${PROJECT_NAME}-addcert -h backup --dhkey 2048
59 59
 fi
60 60
 
61 61
 if [ ! -f /home/${ADMIN_USERNAME}/backup.list ]; then
62
-	exit 1
62
+    exit 1
63 63
 fi
64 64
 
65 65
 # MariaDB password
66 66
 DATABASE_PASSWORD=''
67 67
 if [ -f /root/dbpass ]; then
68
-	DATABASE_PASSWORD=$(cat /root/dbpass)
68
+    DATABASE_PASSWORD=$(cat /root/dbpass)
69 69
 fi
70 70
 
71 71
 # local directory where the backup will be made
72 72
 if [ ! -d $SERVER_DIRECTORY ]; then
73
-	mkdir $SERVER_DIRECTORY
73
+    mkdir $SERVER_DIRECTORY
74 74
 fi
75 75
 
76 76
 if [ ! -d $SERVER_DIRECTORY/backup ]; then
77
-	mkdir -p $SERVER_DIRECTORY/backup
77
+    mkdir -p $SERVER_DIRECTORY/backup
78 78
 fi
79 79
 
80 80
 # The name of a currently suspended site
@@ -82,392 +82,392 @@ fi
82 82
 SUSPENDED_SITE=
83 83
 
84 84
 function suspend_site {
85
-	# suspends a given website
86
-	if [[ $ENABLE_VERIFICATION != "yes" ]]; then
87
-		return
88
-	fi
89
-	SUSPENDED_SITE="$1"
90
-	nginx_dissite $SUSPENDED_SITE
91
-	service nginx reload
85
+    # suspends a given website
86
+    if [[ $ENABLE_VERIFICATION != "yes" ]]; then
87
+        return
88
+    fi
89
+    SUSPENDED_SITE="$1"
90
+    nginx_dissite $SUSPENDED_SITE
91
+    service nginx reload
92 92
 }
93 93
 
94 94
 function restart_site {
95
-	# restarts a given website
96
-	if [ ! $SUSPENDED_SITE ]; then
97
-		return
98
-	fi
99
-	nginx_ensite $SUSPENDED_SITE
100
-	service nginx reload
101
-	SUSPENDED_SITE=
95
+    # restarts a given website
96
+    if [ ! $SUSPENDED_SITE ]; then
97
+        return
98
+    fi
99
+    nginx_ensite $SUSPENDED_SITE
100
+    service nginx reload
101
+    SUSPENDED_SITE=
102 102
 }
103 103
 
104 104
 function backup_configuration {
105
-	echo $"Backing up ${PROJECT_NAME} configuration files"
106
-	temp_backup_dir=/root/tempbackupconfig
107
-	if [ ! -d $temp_backup_dir ]; then
108
-		mkdir -p $temp_backup_dir
109
-	fi
110
-	cp -f $CONFIG_FILE $temp_backup_dir
111
-	cp -f $COMPLETION_FILE $temp_backup_dir
112
-	if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
113
-		cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
114
-	fi
115
-	# nginx password hashes
116
-	if [ -f /etc/nginx/.htpasswd ]; then
117
-		cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
118
-	fi
119
-	backup_directory_to_friend $temp_backup_dir config
105
+    echo $"Backing up ${PROJECT_NAME} configuration files"
106
+    temp_backup_dir=/root/tempbackupconfig
107
+    if [ ! -d $temp_backup_dir ]; then
108
+        mkdir -p $temp_backup_dir
109
+    fi
110
+    cp -f $CONFIG_FILE $temp_backup_dir
111
+    cp -f $COMPLETION_FILE $temp_backup_dir
112
+    if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
113
+        cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
114
+    fi
115
+    # nginx password hashes
116
+    if [ -f /etc/nginx/.htpasswd ]; then
117
+        cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
118
+    fi
119
+    backup_directory_to_friend $temp_backup_dir config
120 120
 }
121 121
 
122 122
 function backup_users {
123
-	for d in /home/*/ ; do
124
-		USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
125
-		if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
126
-
127
-			# personal settings
128
-			if [ -d /home/$USERNAME/personal ]; then
129
-				echo $"Backing up personal settings for $USERNAME"
130
-				backup_directory_to_friend /home/$USERNAME/personal personal/$USERNAME
131
-			fi
132
-
133
-			# gpg keys
134
-			if [ -d /home/$USERNAME/.gnupg ]; then
135
-				echo $"Backing up gpg keys for $USERNAME"
136
-				backup_directory_to_friend /home/$USERNAME/.gnupg gnupg/$USERNAME
137
-			fi
138
-
139
-			# ssh keys
140
-			if [ -d /home/$USERNAME/.ssh ]; then
141
-				echo $"Backing up ssh keys for $USERNAME"
142
-				backup_directory_to_friend /home/$USERNAME/.ssh ssh/$USERNAME
143
-			fi
144
-
145
-			# syncthing files
146
-			if [ -d /home/$USERNAME/Sync ]; then
147
-				echo $"Backing up syncthing files for $USERNAME"
148
-				backup_directory_to_friend /home/$USERNAME/Sync syncthing/$USERNAME
149
-				# ensure that device IDs will be backed up as part of user config settings
150
-				if [ ! -d /home/$USERNAME/.config/syncthing ]; then
151
-					mkdir -p /home/$USERNAME/.config/syncthing
152
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
153
-				fi
154
-				if [ -f /home/$USERNAME/.syncthing-server-id ]; then
155
-					cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
156
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
157
-				fi
158
-				if [ -f /home/$USERNAME/.syncthingids ]; then
159
-					cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
160
-					chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
161
-				fi
162
-			fi
163
-
164
-			# config files
165
-			if [ -d /home/$USERNAME/.config ]; then
166
-				echo $"Backing up config files for $USERNAME"
167
-				backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
168
-			fi
169
-
170
-			# monkeysphere files
171
-			if [ -d /home/$USERNAME/.monkeysphere ]; then
172
-				echo $"Backing up monkeysphere files for $USERNAME"
173
-				backup_directory_to_friend /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
174
-			fi
175
-
176
-			# fin files
177
-			if [ -d /home/$USERNAME/.fin ]; then
178
-				echo $"Backing up fin files for $USERNAME"
179
-				backup_directory_to_friend /home/$USERNAME/.fin fin/$USERNAME
180
-			fi
181
-
182
-			# local files
183
-			if [ -d /home/$USERNAME/.local ]; then
184
-				echo $"Backing up local files for $USERNAME"
185
-				backup_directory_to_friend /home/$USERNAME/.local local/$USERNAME
186
-			fi
187
-
188
-			# mutt settings
189
-			if [ -f /home/$USERNAME/.muttrc ]; then
190
-				echo $"Backing up Mutt settings for $USERNAME"
191
-				if [ ! -d /home/$USERNAME/tempbackup ]; then
192
-					mkdir -p /home/$USERNAME/tempbackup
193
-				fi
194
-				cp /home/$USERNAME/.muttrc /home/$USERNAME/tempbackup
195
-				if [ -f /etc/Muttrc ]; then
196
-					cp /etc/Muttrc /home/$USERNAME/tempbackup
197
-				fi
198
-				backup_directory_to_friend /home/$USERNAME/tempbackup mutt/$USERNAME
199
-			fi
200
-
201
-			# procmail settings
202
-			if [ -f /home/$USERNAME/.procmailrc ]; then
203
-				echo $"Backing up procmail settings for $USERNAME"
204
-				if [ ! -d /home/$USERNAME/tempbackup ]; then
205
-					mkdir -p /home/$USERNAME/tempbackup
206
-				fi
207
-				cp /home/$USERNAME/.procmailrc /home/$USERNAME/tempbackup
208
-				backup_directory_to_friend /home/$USERNAME/tempbackup procmail/$USERNAME
209
-			fi
210
-
211
-			# spamassassin settings
212
-			if [ -d /home/$USERNAME/.spamassassin ]; then
213
-				echo $"Backing up spamassassin settings for $USERNAME"
214
-				backup_directory_to_friend /home/$USERNAME/.spamassassin spamassassin/$USERNAME
215
-			fi
216
-
217
-			# email
218
-			if [ -d /home/$USERNAME/Maildir ]; then
219
-				echo $"Stopping mail server"
220
-				systemctl stop exim4
221
-				echo $"Creating an email archive"
222
-				if [ ! -d /root/backupemail/$USERNAME ]; then
223
-					mkdir -p /root/backupemail/$USERNAME
224
-				fi
225
-				tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
226
-				echo $"Restarting mail server"
227
-				systemctl start exim4
228
-				echo $"Backing up emails for $USERNAME"
229
-				backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME
230
-			fi
231
-		fi
232
-	done
123
+    for d in /home/*/ ; do
124
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
125
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
126
+
127
+            # personal settings
128
+            if [ -d /home/$USERNAME/personal ]; then
129
+                echo $"Backing up personal settings for $USERNAME"
130
+                backup_directory_to_friend /home/$USERNAME/personal personal/$USERNAME
131
+            fi
132
+
133
+            # gpg keys
134
+            if [ -d /home/$USERNAME/.gnupg ]; then
135
+                echo $"Backing up gpg keys for $USERNAME"
136
+                backup_directory_to_friend /home/$USERNAME/.gnupg gnupg/$USERNAME
137
+            fi
138
+
139
+            # ssh keys
140
+            if [ -d /home/$USERNAME/.ssh ]; then
141
+                echo $"Backing up ssh keys for $USERNAME"
142
+                backup_directory_to_friend /home/$USERNAME/.ssh ssh/$USERNAME
143
+            fi
144
+
145
+            # syncthing files
146
+            if [ -d /home/$USERNAME/Sync ]; then
147
+                echo $"Backing up syncthing files for $USERNAME"
148
+                backup_directory_to_friend /home/$USERNAME/Sync syncthing/$USERNAME
149
+                # ensure that device IDs will be backed up as part of user config settings
150
+                if [ ! -d /home/$USERNAME/.config/syncthing ]; then
151
+                    mkdir -p /home/$USERNAME/.config/syncthing
152
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
153
+                fi
154
+                if [ -f /home/$USERNAME/.syncthing-server-id ]; then
155
+                    cp /home/$USERNAME/.syncthing-server-id /home/$USERNAME/.config/syncthing
156
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
157
+                fi
158
+                if [ -f /home/$USERNAME/.syncthingids ]; then
159
+                    cp /home/$USERNAME/.syncthingids /home/$USERNAME/.config/syncthing
160
+                    chown -R $USERNAME:$USERNAME /home/$USERNAME/.config
161
+                fi
162
+            fi
163
+
164
+            # config files
165
+            if [ -d /home/$USERNAME/.config ]; then
166
+                echo $"Backing up config files for $USERNAME"
167
+                backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
168
+            fi
169
+
170
+            # monkeysphere files
171
+            if [ -d /home/$USERNAME/.monkeysphere ]; then
172
+                echo $"Backing up monkeysphere files for $USERNAME"
173
+                backup_directory_to_friend /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
174
+            fi
175
+
176
+            # fin files
177
+            if [ -d /home/$USERNAME/.fin ]; then
178
+                echo $"Backing up fin files for $USERNAME"
179
+                backup_directory_to_friend /home/$USERNAME/.fin fin/$USERNAME
180
+            fi
181
+
182
+            # local files
183
+            if [ -d /home/$USERNAME/.local ]; then
184
+                echo $"Backing up local files for $USERNAME"
185
+                backup_directory_to_friend /home/$USERNAME/.local local/$USERNAME
186
+            fi
187
+
188
+            # mutt settings
189
+            if [ -f /home/$USERNAME/.muttrc ]; then
190
+                echo $"Backing up Mutt settings for $USERNAME"
191
+                if [ ! -d /home/$USERNAME/tempbackup ]; then
192
+                    mkdir -p /home/$USERNAME/tempbackup
193
+                fi
194
+                cp /home/$USERNAME/.muttrc /home/$USERNAME/tempbackup
195
+                if [ -f /etc/Muttrc ]; then
196
+                    cp /etc/Muttrc /home/$USERNAME/tempbackup
197
+                fi
198
+                backup_directory_to_friend /home/$USERNAME/tempbackup mutt/$USERNAME
199
+            fi
200
+
201
+            # procmail settings
202
+            if [ -f /home/$USERNAME/.procmailrc ]; then
203
+                echo $"Backing up procmail settings for $USERNAME"
204
+                if [ ! -d /home/$USERNAME/tempbackup ]; then
205
+                    mkdir -p /home/$USERNAME/tempbackup
206
+                fi
207
+                cp /home/$USERNAME/.procmailrc /home/$USERNAME/tempbackup
208
+                backup_directory_to_friend /home/$USERNAME/tempbackup procmail/$USERNAME
209
+            fi
210
+
211
+            # spamassassin settings
212
+            if [ -d /home/$USERNAME/.spamassassin ]; then
213
+                echo $"Backing up spamassassin settings for $USERNAME"
214
+                backup_directory_to_friend /home/$USERNAME/.spamassassin spamassassin/$USERNAME
215
+            fi
216
+
217
+            # email
218
+            if [ -d /home/$USERNAME/Maildir ]; then
219
+                echo $"Stopping mail server"
220
+                systemctl stop exim4
221
+                echo $"Creating an email archive"
222
+                if [ ! -d /root/backupemail/$USERNAME ]; then
223
+                    mkdir -p /root/backupemail/$USERNAME
224
+                fi
225
+                tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir
226
+                echo $"Restarting mail server"
227
+                systemctl start exim4
228
+                echo $"Backing up emails for $USERNAME"
229
+                backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME
230
+            fi
231
+        fi
232
+    done
233 233
 }
234 234
 
235 235
 function backup_letsencrypt {
236
-	if [ -d /etc/letsencrypt ]; then
237
-		echo $"Backing up Lets Encrypt settings"
238
-		backup_directory_to_friend /etc/letsencrypt letsencrypt
239
-	fi
236
+    if [ -d /etc/letsencrypt ]; then
237
+        echo $"Backing up Lets Encrypt settings"
238
+        backup_directory_to_friend /etc/letsencrypt letsencrypt
239
+    fi
240 240
 }
241 241
 
242 242
 function backup_tor {
243
-	if [ -d /etc/letsencrypt ]; then
244
-		echo $"Backing up Tor settings"
245
-		backup_directory_to_friend /var/lib/tor tor
246
-	fi
243
+    if [ -d /etc/letsencrypt ]; then
244
+        echo $"Backing up Tor settings"
245
+        backup_directory_to_friend /var/lib/tor tor
246
+    fi
247 247
 }
248 248
 
249 249
 function backup_certs {
250
-	if [ -d /etc/ssl ]; then
251
-		echo $"Backing up certificates"
252
-		backup_directory_to_friend /etc/ssl ssl
253
-	fi
250
+    if [ -d /etc/ssl ]; then
251
+        echo $"Backing up certificates"
252
+        backup_directory_to_friend /etc/ssl ssl
253
+    fi
254 254
 }
255 255
 
256 256
 function backup_mailing_list {
257
-	if [ -d /var/spool/mlmmj ]; then
258
-		echo $"Backing up the public mailing list"
259
-		backup_directory_to_friend /var/spool/mlmmj mailinglist
260
-	fi
257
+    if [ -d /var/spool/mlmmj ]; then
258
+        echo $"Backing up the public mailing list"
259
+        backup_directory_to_friend /var/spool/mlmmj mailinglist
260
+    fi
261 261
 }
262 262
 
263 263
 function backup_web_server {
264
-	if [ -d /etc/nginx ]; then
265
-		echo $"Backing up web settings"
266
-		backup_directory_to_friend /etc/nginx/sites-available web
267
-	fi
264
+    if [ -d /etc/nginx ]; then
265
+        echo $"Backing up web settings"
266
+        backup_directory_to_friend /etc/nginx/sites-available web
267
+    fi
268 268
 }
269 269
 
270 270
 function backup_admin_readme {
271
-	if [ -f /home/$ADMIN_USERNAME/README ]; then
272
-		echo $"Backing up README"
273
-		if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
274
-			mkdir -p /home/$ADMIN_USERNAME/tempbackup
275
-		fi
276
-		cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
277
-		backup_directory_to_friend /home/$ADMIN_USERNAME/tempbackup readme
278
-	fi
271
+    if [ -f /home/$ADMIN_USERNAME/README ]; then
272
+        echo $"Backing up README"
273
+        if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
274
+            mkdir -p /home/$ADMIN_USERNAME/tempbackup
275
+        fi
276
+        cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
277
+        backup_directory_to_friend /home/$ADMIN_USERNAME/tempbackup readme
278
+    fi
279 279
 }
280 280
 
281 281
 function backup_mariadb {
282
-	if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
283
-		temp_backup_dir=/root/tempmariadb
284
-		if [ ! -d $temp_backup_dir ]; then
285
-			mkdir $temp_backup_dir
286
-		fi
287
-		mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
288
-		if [ ! -s $temp_backup_dir/mysql.sql ]; then
289
-			echo $"Unable to backup MariaDB settings"
290
-			rm -rf $temp_backup_dir
291
-			# Send a warning email
292
-			echo $"Unable to export database settings" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
293
-			exit 653
294
-		fi
295
-		echo "$DATABASE_PASSWORD" > $temp_backup_dir/db
296
-		chmod 400 $temp_backup_dir/db
297
-		backup_directory_to_friend $temp_backup_dir mariadb
298
-	fi
282
+    if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
283
+        temp_backup_dir=/root/tempmariadb
284
+        if [ ! -d $temp_backup_dir ]; then
285
+            mkdir $temp_backup_dir
286
+        fi
287
+        mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
288
+        if [ ! -s $temp_backup_dir/mysql.sql ]; then
289
+            echo $"Unable to backup MariaDB settings"
290
+            rm -rf $temp_backup_dir
291
+            # Send a warning email
292
+            echo $"Unable to export database settings" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
293
+            exit 653
294
+        fi
295
+        echo "$DATABASE_PASSWORD" > $temp_backup_dir/db
296
+        chmod 400 $temp_backup_dir/db
297
+        backup_directory_to_friend $temp_backup_dir mariadb
298
+    fi
299 299
 }
300 300
 
301 301
 # Returns the filename of a key share
302 302
 function get_key_share {
303
-	no_of_shares=$1
304
-	USERNAME="$2"
305
-	REMOTE_DOMAIN="$3"
303
+    no_of_shares=$1
304
+    USERNAME="$2"
305
+    REMOTE_DOMAIN="$3"
306 306
 
307
-	# Get a share index based on the supplied domain name
308
-	# This ensures that the same share is always given to the same domain
309
-	sharenumstr=$(md5sum <<< "$REMOTE_DOMAIN")
310
-	share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)
307
+    # Get a share index based on the supplied domain name
308
+    # This ensures that the same share is always given to the same domain
309
+    sharenumstr=$(md5sum <<< "$REMOTE_DOMAIN")
310
+    share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)
311 311
 
312
-	# get the filename
313
-	share_files=(/home/$USERNAME/.gnupg_fragments/keyshare.asc.*)
314
-	share_filename=${share_files[share_index]}
312
+    # get the filename
313
+    share_files=(/home/$USERNAME/.gnupg_fragments/keyshare.asc.*)
314
+    share_filename=${share_files[share_index]}
315 315
 
316
-	echo "$share_filename"
316
+    echo "$share_filename"
317 317
 }
318 318
 
319 319
 function disperse_key_shares {
320
-	USERNAME=$1
321
-	REMOTE_DOMAIN=$2
322
-	REMOTE_SSH_PORT=$3
323
-	REMOTE_PASSWORD=$4
324
-	REMOTE_SERVER=$5
325
-
326
-	if [ -d /home/$USERNAME/.gnupg_fragments ]; then
327
-		if [ $REMOTE_DOMAIN ]; then
328
-			cd /home/$USERNAME/.gnupg_fragments
329
-			no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
330
-			if (( no_of_shares > 1 )); then
331
-				share_filename=$(get_key_share $no_of_shares "$USERNAME" "$REMOTE_DOMAIN")
332
-
333
-				# create a temp directory containing the share
334
-				temp_key_share_dir=/home/$USERNAME/tempkey
335
-				temp_key_share_fragments=$temp_key_share_dir/.gnupg_fragments_${USERNAME}
336
-				mkdir -p $temp_key_share_fragments
337
-				cp $share_filename $temp_key_share_fragments/
338
-
339
-				# copy the fragments directory to the remote server
340
-				/usr/bin/sshpass -p "$REMOTE_PASSWORD" \
341
-								 scp -r -P $REMOTE_SSH_PORT $temp_key_share_fragments $REMOTE_SERVER
342
-				if [ ! "$?" = "0" ]; then
343
-					# Send a warning email
344
-					echo "Key share to $REMOTE_SERVER failed" | \
345
-						mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
346
-				else
347
-					# Send a confirmation email
348
-					echo "Key ${share_filename} shared to $REMOTE_SERVER" | \
349
-						mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
350
-				fi
351
-
352
-				# remove the temp file/directory
353
-				shred -zu $temp_key_share_fragments/*
354
-				rm -rf $temp_key_share_dir
355
-			fi
356
-		fi
357
-	fi
320
+    USERNAME=$1
321
+    REMOTE_DOMAIN=$2
322
+    REMOTE_SSH_PORT=$3
323
+    REMOTE_PASSWORD=$4
324
+    REMOTE_SERVER=$5
325
+
326
+    if [ -d /home/$USERNAME/.gnupg_fragments ]; then
327
+        if [ $REMOTE_DOMAIN ]; then
328
+            cd /home/$USERNAME/.gnupg_fragments
329
+            no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
330
+            if (( no_of_shares > 1 )); then
331
+                share_filename=$(get_key_share $no_of_shares "$USERNAME" "$REMOTE_DOMAIN")
332
+
333
+                # create a temp directory containing the share
334
+                temp_key_share_dir=/home/$USERNAME/tempkey
335
+                temp_key_share_fragments=$temp_key_share_dir/.gnupg_fragments_${USERNAME}
336
+                mkdir -p $temp_key_share_fragments
337
+                cp $share_filename $temp_key_share_fragments/
338
+
339
+                # copy the fragments directory to the remote server
340
+                /usr/bin/sshpass -p "$REMOTE_PASSWORD" \
341
+                                 scp -r -P $REMOTE_SSH_PORT $temp_key_share_fragments $REMOTE_SERVER
342
+                if [ ! "$?" = "0" ]; then
343
+                    # Send a warning email
344
+                    echo "Key share to $REMOTE_SERVER failed" | \
345
+                        mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
346
+                else
347
+                    # Send a confirmation email
348
+                    echo "Key ${share_filename} shared to $REMOTE_SERVER" | \
349
+                        mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
350
+                fi
351
+
352
+                # remove the temp file/directory
353
+                shred -zu $temp_key_share_fragments/*
354
+                rm -rf $temp_key_share_dir
355
+            fi
356
+        fi
357
+    fi
358 358
 }
359 359
 
360 360
 function valid_backup_destination {
361
-	destination_dir="$1"
362
-	is_valid="yes"
363
-
364
-	if [[ "$destination_dir" == "hubzilla" || \
365
-				"$destination_dir" == "hubzilladata" || \
366
-				"$destination_dir" == "gogs" || \
367
-				"$destination_dir" == "gogsrepos" || \
368
-				"$destination_dir" == "gogsssh" || \
369
-				"$destination_dir" == "gnusocial" || \
370
-				"$destination_dir" == "gnusocialdata" || \
371
-				"$destination_dir" == "mariadb" || \
372
-				"$destination_dir" == "config" || \
373
-				"$destination_dir" == "letsencrypt" || \
374
-				"$destination_dir" == "wiki" || \
375
-				"$destination_dir" == "wiki2" || \
376
-				"$destination_dir" == "xmpp" || \
377
-				"$destination_dir" == "ipfs" || \
378
-				"$destination_dir" == "dlna" || \
379
-				"$destination_dir" == "tox" || \
380
-				"$destination_dir" == "ssl" || \
381
-				"$destination_dir" == "blog" || \
382
-				"$destination_dir" == "syncthing" || \
383
-				"$destination_dir" == "syncthingconfig" || \
384
-				"$destination_dir" == "syncthingshared" || \
385
-				"$destination_dir" == "mailinglist" ]]; then
386
-		is_valid="no"
387
-	fi
388
-
389
-	echo $is_valid
361
+    destination_dir="$1"
362
+    is_valid="yes"
363
+
364
+    if [[ "$destination_dir" == "hubzilla" || \
365
+                "$destination_dir" == "hubzilladata" || \
366
+                "$destination_dir" == "gogs" || \
367
+                "$destination_dir" == "gogsrepos" || \
368
+                "$destination_dir" == "gogsssh" || \
369
+                "$destination_dir" == "gnusocial" || \
370
+                "$destination_dir" == "gnusocialdata" || \
371
+                "$destination_dir" == "mariadb" || \
372
+                "$destination_dir" == "config" || \
373
+                "$destination_dir" == "letsencrypt" || \
374
+                "$destination_dir" == "wiki" || \
375
+                "$destination_dir" == "wiki2" || \
376
+                "$destination_dir" == "xmpp" || \
377
+                "$destination_dir" == "ipfs" || \
378
+                "$destination_dir" == "dlna" || \
379
+                "$destination_dir" == "tox" || \
380
+                "$destination_dir" == "ssl" || \
381
+                "$destination_dir" == "blog" || \
382
+                "$destination_dir" == "syncthing" || \
383
+                "$destination_dir" == "syncthingconfig" || \
384
+                "$destination_dir" == "syncthingshared" || \
385
+                "$destination_dir" == "mailinglist" ]]; then
386
+        is_valid="no"
387
+    fi
388
+
389
+    echo $is_valid
390 390
 }
391 391
 
392 392
 function backup_extra_directories {
393
-	if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
394
-		return
395
-	fi
396
-
397
-	echo $"Backing up some additional directories"
398
-	while read backup_line
399
-	do
400
-		backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
401
-		if [ -d "$backup_dir" ]; then
402
-			destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
403
-			if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
404
-				backup_directory_to_friend "$backup_dir" "$destination_dir"
405
-			else
406
-				echo $"WARNING: The backup directory $destination_dir is already used."
407
-				echo $"Choose a different destination name for backing up $backup_dir"
408
-			fi
409
-		else
410
-			echo $"WARNING: Directory $backup_dir does not exist"
411
-		fi
412
-	done <$BACKUP_EXTRA_DIRECTORIES
393
+    if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
394
+        return
395
+    fi
396
+
397
+    echo $"Backing up some additional directories"
398
+    while read backup_line
399
+    do
400
+        backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
401
+        if [ -d "$backup_dir" ]; then
402
+            destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
403
+            if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
404
+                backup_directory_to_friend "$backup_dir" "$destination_dir"
405
+            else
406
+                echo $"WARNING: The backup directory $destination_dir is already used."
407
+                echo $"Choose a different destination name for backing up $backup_dir"
408
+            fi
409
+        else
410
+            echo $"WARNING: Directory $backup_dir does not exist"
411
+        fi
412
+    done <$BACKUP_EXTRA_DIRECTORIES
413 413
 }
414 414
 
415 415
 TEST_MODE="no"
416 416
 if [[ "$1" == "test" ]]; then
417
-	TEST_MODE="yes"
417
+    TEST_MODE="yes"
418 418
 fi
419 419
 
420 420
 backup_configuration
421 421
 if [[ $TEST_MODE == "no" ]]; then
422
-	backup_users
423
-	backup_letsencrypt
424
-	backup_tor
425
-	backup_web_server
426
-	backup_admin_readme
427
-	backup_mariadb
428
-	backup_certs
429
-	backup_mailing_list
430
-	backup_apps remote
431
-	backup_extra_directories
422
+    backup_users
423
+    backup_letsencrypt
424
+    backup_tor
425
+    backup_web_server
426
+    backup_admin_readme
427
+    backup_mariadb
428
+    backup_certs
429
+    backup_mailing_list
430
+    backup_apps remote
431
+    backup_extra_directories
432 432
 fi
433 433
 
434 434
 # For each remote server
435 435
 while read remote_server
436 436
 do
437
-	# Get the server and its password
438
-	# Format is:
439
-	#   username@domain <port number> /home/username <ssh password>
440
-	REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}')
441
-	if [ $REMOTE_SERVER ]; then
442
-		REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ' ' '{print $1}' | awk -F '@' '{print $2}')
443
-		REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}')
444
-		REMOTE_DIRECTORY=$(echo "${remote_server}" | awk -F ' ' '{print $3}')
445
-		REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $4}')
446
-		NOW=$(date +"%Y-%m-%d %H:%M:%S")
447
-		REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
448
-
449
-		echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log
450
-
451
-		# Social key management
452
-		for d in /home/*/ ; do
453
-			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
454
-			if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
455
-				disperse_key_shares $USERNAME $REMOTE_DOMAIN $REMOTE_SSH_PORT "$REMOTE_PASSWORD" $REMOTE_SERVER
456
-			fi
457
-		done
458
-
459
-		if [[ $TEST_MODE == "yes" ]]; then
460
-			echo "rsync -ratlzv --rsh=\"/usr/bin/sshpass -p '$REMOTE_PASSWORD' ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no\" $SERVER_DIRECTORY/backup $REMOTE_SERVER"
461
-		fi
462
-		rsync -ratlzv --rsh="/usr/bin/sshpass -p \"$REMOTE_PASSWORD\" ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no" $SERVER_DIRECTORY/backup $REMOTE_SERVER
463
-		if [ ! "$?" = "0" ]; then
464
-			echo "$NOW Backup to $REMOTE_SERVER failed" >> /var/log/remotebackups.log
465
-			# Send a warning email
466
-			echo "Backup to $REMOTE_SERVER failed" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
467
-		else
468
-			echo "$NOW Backed up to $REMOTE_SERVER" >> /var/log/remotebackups.log
469
-		fi
470
-	fi
437
+    # Get the server and its password
438
+    # Format is:
439
+    #   username@domain <port number> /home/username <ssh password>
440
+    REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}')
441
+    if [ $REMOTE_SERVER ]; then
442
+        REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ' ' '{print $1}' | awk -F '@' '{print $2}')
443
+        REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}')
444
+        REMOTE_DIRECTORY=$(echo "${remote_server}" | awk -F ' ' '{print $3}')
445
+        REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $4}')
446
+        NOW=$(date +"%Y-%m-%d %H:%M:%S")
447
+        REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
448
+
449
+        echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log
450
+
451
+        # Social key management
452
+        for d in /home/*/ ; do
453
+            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
454
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
455
+                disperse_key_shares $USERNAME $REMOTE_DOMAIN $REMOTE_SSH_PORT "$REMOTE_PASSWORD" $REMOTE_SERVER
456
+            fi
457
+        done
458
+
459
+        if [[ $TEST_MODE == "yes" ]]; then
460
+            echo "rsync -ratlzv --rsh=\"/usr/bin/sshpass -p '$REMOTE_PASSWORD' ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no\" $SERVER_DIRECTORY/backup $REMOTE_SERVER"
461
+        fi
462
+        rsync -ratlzv --rsh="/usr/bin/sshpass -p \"$REMOTE_PASSWORD\" ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no" $SERVER_DIRECTORY/backup $REMOTE_SERVER
463
+        if [ ! "$?" = "0" ]; then
464
+            echo "$NOW Backup to $REMOTE_SERVER failed" >> /var/log/remotebackups.log
465
+            # Send a warning email
466
+            echo "Backup to $REMOTE_SERVER failed" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
467
+        else
468
+            echo "$NOW Backed up to $REMOTE_SERVER" >> /var/log/remotebackups.log
469
+        fi
470
+    fi
471 471
 
472 472
 done < /home/${ADMIN_USERNAME}/backup.list
473 473
 

+ 1379
- 1379
src/freedombone-base-email
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1849
- 1837
src/freedombone-controlpanel
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 11
- 11
src/freedombone-restore-local Dosyayı Görüntüle

@@ -238,7 +238,7 @@ function restore_mutt_settings {
238 238
     if [ -d $USB_MOUNT/backup/mutt ]; then
239 239
         for d in $USB_MOUNT/backup/mutt/*/ ; do
240 240
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
241
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
241
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
242 242
                 if [ ! -d /home/$USERNAME ]; then
243 243
                     ${PROJECT_NAME}-adduser $USERNAME
244 244
                 fi
@@ -272,7 +272,7 @@ function restore_gpg {
272 272
     if [ -d $USB_MOUNT/backup/gnupg ]; then
273 273
         for d in $USB_MOUNT/backup/gnupg/*/ ; do
274 274
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
275
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
275
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
276 276
                 if [ ! -d /home/$USERNAME ]; then
277 277
                     ${PROJECT_NAME}-adduser $USERNAME
278 278
                 fi
@@ -309,7 +309,7 @@ function restore_procmail {
309 309
     if [ -d $USB_MOUNT/backup/procmail ]; then
310 310
         for d in $USB_MOUNT/backup/procmail/*/ ; do
311 311
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
312
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
312
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
313 313
                 if [ ! -d /home/$USERNAME ]; then
314 314
                     ${PROJECT_NAME}-adduser $USERNAME
315 315
                 fi
@@ -338,7 +338,7 @@ function restore_spamassassin {
338 338
     if [ -d $USB_MOUNT/backup/spamassassin ]; then
339 339
         for d in $USB_MOUNT/backup/spamassassin/*/ ; do
340 340
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
341
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
341
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
342 342
                 if [ -d $USB_MOUNT/backup/spamassassin/$USERNAME ]; then
343 343
                     if [ ! -d /home/$USERNAME ]; then
344 344
                         ${PROJECT_NAME}-adduser $USERNAME
@@ -399,7 +399,7 @@ function restore_user_ssh_keys {
399 399
     if [ -d $USB_MOUNT/backup/ssh ]; then
400 400
         for d in $USB_MOUNT/backup/ssh/*/ ; do
401 401
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
402
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
402
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
403 403
                 if [ ! -d /home/$USERNAME ]; then
404 404
                     ${PROJECT_NAME}-adduser $USERNAME
405 405
                 fi
@@ -428,7 +428,7 @@ function restore_user_config {
428 428
     if [ -d $USB_MOUNT/backup/config ]; then
429 429
         for d in $USB_MOUNT/backup/config/*/ ; do
430 430
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
431
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
431
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
432 432
                 if [ ! -d /home/$USERNAME ]; then
433 433
                     ${PROJECT_NAME}-adduser $USERNAME
434 434
                 fi
@@ -469,7 +469,7 @@ function restore_user_monkeysphere {
469 469
     if [ -d $USB_MOUNT/backup/monkeysphere ]; then
470 470
         for d in $USB_MOUNT/backup/monkeysphere/*/ ; do
471 471
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
472
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
472
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
473 473
                 if [ ! -d /home/$USERNAME ]; then
474 474
                     ${PROJECT_NAME}-adduser $USERNAME
475 475
                 fi
@@ -508,7 +508,7 @@ function restore_user_fin {
508 508
     if [ -d $USB_MOUNT/backup/fin ]; then
509 509
         for d in $USB_MOUNT/backup/fin/*/ ; do
510 510
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
511
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
511
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
512 512
                 if [ ! -d /home/$USERNAME ]; then
513 513
                     ${PROJECT_NAME}-adduser $USERNAME
514 514
                 fi
@@ -537,7 +537,7 @@ function restore_user_local {
537 537
     if [ -d $USB_MOUNT/backup/local ]; then
538 538
         for d in $USB_MOUNT/backup/local/*/ ; do
539 539
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
540
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
540
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
541 541
                 if [ ! -d /home/$USERNAME ]; then
542 542
                     ${PROJECT_NAME}-adduser $USERNAME
543 543
                 fi
@@ -610,7 +610,7 @@ function restore_personal_settings {
610 610
     if [ -d $USB_MOUNT/backup/personal ]; then
611 611
         for d in $USB_MOUNT/backup/personal/*/ ; do
612 612
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
613
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
613
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
614 614
                 if [ -d $USB_MOUNT/backup/personal/$USERNAME ]; then
615 615
                     if [ ! -d /home/$USERNAME ]; then
616 616
                         ${PROJECT_NAME}-adduser $USERNAME
@@ -663,7 +663,7 @@ function restore_email {
663 663
     if [ -d $USB_MOUNT/backup/mail ]; then
664 664
         for d in $USB_MOUNT/backup/mail/*/ ; do
665 665
             USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
666
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
666
+            if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
667 667
                 if [ ! -d /home/$USERNAME ]; then
668 668
                     ${PROJECT_NAME}-adduser $USERNAME
669 669
                 fi

+ 11
- 11
src/freedombone-restore-remote Dosyayı Görüntüle

@@ -225,7 +225,7 @@ function restore_mutt_settings {
225 225
     fi
226 226
     for d in $SERVER_DIRECTORY/backup/mutt/*/ ; do
227 227
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
228
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
228
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
229 229
             if [ -d $SERVER_DIRECTORY/backup/mutt/$USERNAME ]; then
230 230
                 if [ ! -d /home/$USERNAME ]; then
231 231
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -257,7 +257,7 @@ function restore_gpg {
257 257
     fi
258 258
     for d in $SERVER_DIRECTORY/backup/gnupg/*/ ; do
259 259
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
260
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
260
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
261 261
             if [ -d $SERVER_DIRECTORY/backup/gnupg/$USERNAME ]; then
262 262
                 if [ ! -d /home/$USERNAME ]; then
263 263
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -290,7 +290,7 @@ function restore_procmail {
290 290
     fi
291 291
     for d in $SERVER_DIRECTORY/backup/procmail/*/ ; do
292 292
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
293
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
293
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
294 294
             if [ -d $SERVER_DIRECTORY/backup/procmail/$USERNAME ]; then
295 295
                 if [ ! -d /home/$USERNAME ]; then
296 296
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -317,7 +317,7 @@ function restore_spamassassin {
317 317
     fi
318 318
     for d in $SERVER_DIRECTORY/backup/spamassassin/*/ ; do
319 319
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
320
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
320
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
321 321
             if [ -d $SERVER_DIRECTORY/backup/spamassassin/$USERNAME ]; then
322 322
                 if [ ! -d /home/$USERNAME ]; then
323 323
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -363,7 +363,7 @@ function restore_ssh_keys {
363 363
     fi
364 364
     for d in $SERVER_DIRECTORY/backup/ssh/*/ ; do
365 365
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
366
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
366
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
367 367
             if [ -d $SERVER_DIRECTORY/backup/ssh/$USERNAME ]; then
368 368
                 if [ ! -d /home/$USERNAME ]; then
369 369
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -390,7 +390,7 @@ function restore_user_config {
390 390
     fi
391 391
     for d in $SERVER_DIRECTORY/backup/config/*/ ; do
392 392
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
393
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
393
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
394 394
             if [ -d $SERVER_DIRECTORY/backup/config/$USERNAME ]; then
395 395
                 if [ ! -d /home/$USERNAME ]; then
396 396
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -429,7 +429,7 @@ function restore_user_monkeysphere {
429 429
     fi
430 430
     for d in $SERVER_DIRECTORY/backup/monkeysphere/*/ ; do
431 431
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
432
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
432
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
433 433
             if [ -d $SERVER_DIRECTORY/backup/monkeysphere/$USERNAME ]; then
434 434
                 if [ ! -d /home/$USERNAME ]; then
435 435
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -466,7 +466,7 @@ function restore_user_fin {
466 466
     fi
467 467
     for d in $SERVER_DIRECTORY/backup/fin/*/ ; do
468 468
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
469
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
469
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
470 470
             if [ -d $SERVER_DIRECTORY/backup/fin/$USERNAME ]; then
471 471
                 if [ ! -d /home/$USERNAME ]; then
472 472
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -493,7 +493,7 @@ function restore_user_local {
493 493
     fi
494 494
     for d in $SERVER_DIRECTORY/backup/local/*/ ; do
495 495
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
496
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
496
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
497 497
             if [ -d $SERVER_DIRECTORY/backup/local/$USERNAME ]; then
498 498
                 if [ ! -d /home/$USERNAME ]; then
499 499
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -561,7 +561,7 @@ function restore_personal_settings {
561 561
     fi
562 562
     for d in $SERVER_DIRECTORY/backup/personal/*/ ; do
563 563
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
564
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
564
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
565 565
             if [ -d $SERVER_DIRECTORY/backup/personal/$USERNAME ]; then
566 566
                 if [ ! -d /home/$USERNAME ]; then
567 567
                     ${PROJECT_NAME}-adduser $USERNAME
@@ -608,7 +608,7 @@ function restore_email {
608 608
     fi
609 609
     for d in $SERVER_DIRECTORY/backup/mail/*/ ; do
610 610
         USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
611
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
611
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
612 612
             if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then
613 613
                 if [ ! -d /home/$USERNAME ]; then
614 614
                     ${PROJECT_NAME}-adduser $USERNAME

+ 2
- 2
src/freedombone-sec Dosyayı Görüntüle

@@ -336,7 +336,7 @@ function send_monkeysphere_server_keys_to_users {
336 336
     monkeysphere_server_keys=$(monkeysphere-host show-key | grep $"OpenPGP fingerprint" | awk -F ' ' '{print $3}')
337 337
     for d in /home/*/ ; do
338 338
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
339
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
339
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
340 340
             if [ ! -d /home/$USERNAME/.monkeysphere ]; then
341 341
                 mkdir /home/$USERNAME/.monkeysphere
342 342
             fi
@@ -952,7 +952,7 @@ function export_settings {
952 952
 function refresh_gpg_keys {
953 953
     for d in /home/*/ ; do
954 954
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
955
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
955
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
956 956
             su -c 'gpg --refresh-keys' - $USERNAME
957 957
         fi
958 958
     done

+ 11
- 11
src/freedombone-syncthing Dosyayı Görüntüle

@@ -76,8 +76,8 @@ function create_syncthing_config {
76 76
         if [ -f $SYNCTHING_CONFIG_FILE ]; then
77 77
             SYNCTHING_ID=$(cat $SYNCTHING_CONFIG_FILE | grep "device id=" | head -n 1 | awk -F '"' '{print $2}')
78 78
         else
79
-            SYNCTHING_ID=$(new_syncthing_id)            
80
-        fi      
79
+            SYNCTHING_ID=$(new_syncthing_id)
80
+        fi
81 81
     fi
82 82
 
83 83
     if ! grep -q "Syncthing ID" $COMPLETION_FILE; then
@@ -97,7 +97,7 @@ function create_syncthing_config {
97 97
 
98 98
     for d in /home/*/ ; do
99 99
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
100
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
100
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
101 101
             echo "    <folder id=\"$USERNAME\" path=\"/home/$USERNAME/Sync/\" ro=\"false\" rescanIntervalS=\"60\" ignorePerms=\"false\" autoNormalize=\"true\">" >> $SYNCTHING_CONFIG_FILE
102 102
             # include any specified device IDs for this user
103 103
             if [ -f /home/$USERNAME/$SYNCTHING_USER_IDS_FILE ]; then
@@ -137,7 +137,7 @@ function create_syncthing_config {
137 137
     echo "" > $TEMP_IDS_FILE
138 138
     for d in /home/*/ ; do
139 139
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
140
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
140
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
141 141
             if [ -f /home/$USERNAME/$SYNCTHING_USER_IDS_FILE ]; then
142 142
                 while read -r line || [[ -n "$line" ]]; do
143 143
                     line2="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
@@ -169,7 +169,7 @@ function create_syncthing_config {
169 169
     echo '        <disableSparseFiles>false</disableSparseFiles>' >> $SYNCTHING_CONFIG_FILE
170 170
     echo '    </folder>' >> $SYNCTHING_CONFIG_FILE
171 171
 
172
-    
172
+
173 173
     echo "    <device id=\"$SYNCTHING_ID\" name=\"${PROJECT_NAME}\" compression=\"metadata\" introducer=\"false\">" >> $SYNCTHING_CONFIG_FILE
174 174
     echo '        <address>dynamic</address>' >> $SYNCTHING_CONFIG_FILE
175 175
     echo '    </device>' >> $SYNCTHING_CONFIG_FILE
@@ -177,7 +177,7 @@ function create_syncthing_config {
177 177
     echo "" > $TEMP_IDS_FILE
178 178
     for d in /home/*/ ; do
179 179
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
180
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
180
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
181 181
             if [ -f /home/$USERNAME/$SYNCTHING_USER_IDS_FILE ]; then
182 182
                 while read -r line || [[ -n "$line" ]]; do
183 183
                     line2="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
@@ -195,7 +195,7 @@ function create_syncthing_config {
195 195
             fi
196 196
         fi
197 197
     done
198
-    rm $TEMP_IDS_FILE   
198
+    rm $TEMP_IDS_FILE
199 199
 
200 200
     echo '    <options>' >> $SYNCTHING_CONFIG_FILE
201 201
     echo "        <listenAddress>tcp://0.0.0.0:$SYNCTHING_PORT</listenAddress>" >> $SYNCTHING_CONFIG_FILE
@@ -236,7 +236,7 @@ function create_syncthing_config {
236 236
     # This allows it to appear within the user control panel
237 237
     for d in /home/*/ ; do
238 238
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
239
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
239
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
240 240
             echo "$SYNCTHING_ID" > /home/$USERNAME/.syncthing-server-id
241 241
             chown $USERNAME:$USERNAME /home/$USERNAME/.syncthing-server-id
242 242
         fi
@@ -254,14 +254,14 @@ function user_devices_changed {
254 254
         CHANGED=1
255 255
         return
256 256
     fi
257
-    
257
+
258 258
     for d in /home/*/ ; do
259 259
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
260
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
260
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
261 261
             if [ -f /home/$USERNAME/$SYNCTHING_UPDATE_FILE ]; then
262 262
                 CHANGED=1
263 263
             fi
264
-            
264
+
265 265
             if [ -f /home/$USERNAME/$SYNCTHING_USER_IDS_FILE ]; then
266 266
                 while read -r line || [[ -n "$line" ]]; do
267 267
                     if [[ $line != *"#"* && $line != *"*"* && $line != *'/'*  && $line == *"-"* ]]; then

+ 1
- 1
src/freedombone-utils-backup Dosyayı Görüntüle

@@ -275,7 +275,7 @@ function set_user_permissions {
275 275
     echo $"Setting permissions"
276 276
     for d in /home/*/ ; do
277 277
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
278
-        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
278
+        if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" && $USERNAME != "tahoelafs" ]]; then
279 279
             chown -R $USERNAME:$USERNAME /home/$USERNAME
280 280
         fi
281 281
     done