-
Notifications
You must be signed in to change notification settings - Fork 0
/
guifimaps-entry.pl
48 lines (39 loc) · 1.17 KB
/
guifimaps-entry.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl
# This script configures fiberfy for first time
#
use warnings;
use strict;
print "Checking configurations...\n";
if (! -e "INSTALLED") {
my $output = `rm -rf {,.[!.],..?}*`;
if ($? != 0) {
# Error
die "Error erasing all volume.\n";
}
$output = `mkdir -p maps.guifi.net/guifimaps`;
if ($? != 0) {
# Error
die "Error creating necessary subdirs.\n";
}
$output = `cd maps.guifi.net/guifimaps && git init && git remote add origin https://github.com/guifi/guifimaps.git \\
&& git fetch && git checkout -t origin/docker`;
if ($? != 0) {
# Error
die "Error getting code from git repository.\n";
}
$output = `cd maps.guifi.net/guifimaps && chown -R $ENV{GMAPS_UNIX_USER}:www-data . && chown -R $ENV{GMAPS_UNIX_USER}:www-data ./data`;
if ($? != 0) {
# Error
die "Error changing permissions.\n";
}
# make INSTALLED file
$output = `touch INSTALLED`;
if ($? != 0) {
# Error
die "Error creating INSTALLED file.\n";
}
print "Guifi.net guifimaps successfully installed in Docker image!\n";
}
else {
print "Already installed.\n";
}