822
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
1 #!/bin/sh |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
2 |
799
|
3 vars="gitd_ip gitd_basepath git_name git_email tinydns_config tinydns__rootsrvrname tinydns__rootsrvrip tinydns__tldsrvrname tinydns__tldsrvrip tinydns__srvrip tinydns__srvrname" |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
4 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
5 echo "Welcome to the resdb configurator!" >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
6 echo >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
7 |
822
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
8 if ! echo "$var=${!var}" >/dev/null 2>&1; then |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
9 echo "Your shell sucks. If you're using a stupid OS like Ubuntu that doesn't" >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
10 echo "give a damn about backwards compatibility, I'd suggest fixing your" >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
11 echo "default shell, which you can do by typing \"ln -s bash /bin/sh\" at a" >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
12 echo "root shell prompt." >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
13 echo "If you have some ancient Unix system, I'd suggest installing bash." >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
14 echo "If you have questions, you can always bother SRN :-)" >&2 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
15 exit 1 |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
16 fi |
656b9133db24
See commit b422ead31b077041cb030064008c6cd26ba058d0 for more info.
Nick <nick@somerandomnick.ano>
diff
changeset
|
17 |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
18 for var in $vars ; do |
12
|
19 export "$var"="$(cat conf/$var 2>/dev/null)" |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
20 done |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
21 if [ x"$gitd_basepath" = x ]; then |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
22 gitd_basepath="$(pwd)/" |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
23 fi |
287
|
24 if [ x"$git_name" = x ]; then |
|
25 git_name="Anonymous Coward" |
|
26 fi |
|
27 if [ x"$git_email" = x ]; then |
|
28 git_email="nobody@nowhere" |
|
29 fi |
12
|
30 if [ x"$tinydns_config" = x ]; then |
|
31 tinydns_config=n |
|
32 fi |
622
|
33 if [ x"$tinydns__rootsrvrname" = x ]; then |
|
34 tinydns__rootsrvrname="uz5hn5hz5x5bp09p5z2806x4gngcw1k5j2wk88fuvkth5pp2hw4t2d.rootns.somerandomnick.ano" |
|
35 fi |
|
36 if [ x"$tinydns__rootsrvrip" = x ]; then |
|
37 tinydns__rootsrvrip="1.0.27.39" |
|
38 fi |
12
|
39 if [ x"$tinydns__tldsrvrname" = x ]; then |
|
40 tinydns__tldsrvrname="uz5fvb7zdqyuz4q8ysjdfuf04kzd2lrt0l6fp4uyguxdg5tfut06ck.anons.somerandomnick.ano" |
|
41 fi |
|
42 if [ x"$tinydns__tldsrvrip" = x ]; then |
|
43 tinydns__tldsrvrip="1.0.27.37" |
|
44 fi |
799
|
45 if [ x"$tinydns__srvrname" = x ]; then |
|
46 tinydns__srvrname="uz5z6spsd4jsd2k984wuzknr13gwjc630gmvtcv4bmpsrb04c179h1.ns.somerandomnick.ano" |
|
47 fi |
|
48 if [ x"$tinydns__srvrip" = x ]; then |
|
49 tinydns__srvrip="1.0.27.86" |
|
50 fi |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
51 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
52 echo "Please enter the IP address you'd like gitd to listen on." >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
53 echo "(Default: $gitd_ip)" >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
54 echo -n "IP? " >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
55 read new_gitd_ip |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
56 if [ x"$new_gitd_ip" != x ]; then |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
57 gitd_ip="$new_gitd_ip" |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
58 fi |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
59 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
60 echo "Please enter the full path to resdb." >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
61 echo "(Default: $gitd_basepath)" >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
62 echo -n "BasePath? " >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
63 read new_gitd_basepath |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
64 if [ x"$new_gitd_basepath" != x ]; then |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
65 gitd_basepath="$new_gitd_basepath" |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
66 fi |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
67 |
287
|
68 echo "Please enter your name." >&2 |
|
69 echo "(Default: $git_name)" >&2 |
|
70 echo -n "Name? " >&2 |
|
71 read new_git_name |
|
72 if [ x"$new_git_name" != x ]; then |
|
73 git_name="$new_git_name" |
|
74 fi |
|
75 |
|
76 echo "Please enter your email." >&2 |
|
77 echo "(Default: $git_email)" >&2 |
|
78 echo -n "Email? " >&2 |
|
79 read new_git_email |
|
80 if [ x"$new_git_email" != x ]; then |
288
|
81 git_email="$new_git_email" |
287
|
82 fi |
|
83 |
12
|
84 echo -n "Would you like to configure the tinydns datafile generator? " >&2 |
|
85 read new_tinydns_config |
|
86 if [ x"$new_tinydns_config" != x ]; then |
|
87 tinydns_config="$new_tinydns_config" |
|
88 fi |
|
89 if [ x"$tinydns_config" = xy ]; then |
622
|
90 echo "Please enter the hostname of your root nameserver." >&2 |
|
91 echo "(Default: $tinydns__rootsrvrname)" >&2 |
|
92 echo -n "RootSrvName? " >&2 |
|
93 read new_tinydns__rootsrvrname |
|
94 if [ x"$new_tinydns__rootsrvrname" != x ]; then |
|
95 tinydns__rootsrvrname="$new_tinydns__rootsrvrname" |
|
96 fi |
|
97 |
|
98 echo "Please enter the IP address of your root nameserver." >&2 |
|
99 echo "(Default: $tinydns__rootsrvrip)" >&2 |
|
100 echo -n "RootSrvIP? " >&2 |
|
101 read new_tinydns__rootsrvrip |
|
102 if [ x"$new_tinydns__rootsrvrip" != x ]; then |
|
103 tinydns__rootsrvrip="$new_tinydns__rootsrvrip" |
|
104 fi |
|
105 |
12
|
106 echo "Please enter the hostname of your .ano TLD server." >&2 |
|
107 echo "(Default: $tinydns__tldsrvrname)" >&2 |
|
108 echo -n "TLDSrvName? " >&2 |
|
109 read new_tinydns__tldsrvrname |
|
110 if [ x"$new_tinydns__tldsrvrname" != x ]; then |
|
111 tinydns__tldsrvrname="$new_tinydns__tldsrvrname" |
|
112 fi |
|
113 |
|
114 echo "Please enter the IP address of your .ano TLD server." >&2 |
|
115 echo "(Default: $tinydns__tldsrvrip)" >&2 |
|
116 echo -n "TLDSrvIP? " >&2 |
|
117 read new_tinydns__tldsrvrip |
|
118 if [ x"$new_tinydns__tldsrvrip" != x ]; then |
|
119 tinydns__tldsrvrip="$new_tinydns__tldsrvrip" |
|
120 fi |
799
|
121 |
|
122 echo "Please enter the hostname of your nameserver." >&2 |
|
123 echo "(Default: $tinydns__srvrname)" >&2 |
|
124 echo -n "SrvName? " >&2 |
|
125 read new_tinydns__srvrname |
|
126 if [ x"$new_tinydns__srvrname" != x ]; then |
|
127 tinydns__srvrname="$new_tinydns__srvrname" |
|
128 fi |
|
129 |
|
130 echo "Please enter the IP address of your nameserver." >&2 |
|
131 echo "(Default: $tinydns__srvrip)" >&2 |
|
132 echo -n "SrvIP? " >&2 |
|
133 read new_tinydns__srvrip |
|
134 if [ x"$new_tinydns__srvrip" != x ]; then |
|
135 tinydns__srvrip="$new_tinydns__srvrip" |
|
136 fi |
12
|
137 fi |
|
138 |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
139 echo "Proposed configuration:" >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
140 for var in $vars ; do |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
141 echo "$var=${!var}" >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
142 done |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
143 echo -n "To write the configuration, hit RETURN. To abort, hit ^C: " >&2 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
144 read write_config |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
145 |
287
|
146 echo -n "Writing configuration... " >&2 |
9
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
147 mkdir -p conf || exit 1 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
148 for var in $vars ; do |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
149 echo "${!var}" > conf/"$var" || exit 1 |
8f9565400a0f
added configure script (so you don't have to modify gitd itself)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
150 done |
287
|
151 echo "Done" >&2 |
|
152 |
|
153 echo -n "Updating git configuration... " >&2 |
|
154 cd "$(cat ./conf/gitd_basepath)" || exit 1 |
|
155 git config user.name "$(cat ./conf/git_name)" || exit 1 |
|
156 git config user.email "$(cat ./conf/git_email)" || exit 1 |
|
157 echo "Done" >&2 |