summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-03-18 10:43:48 +0100
committerYorhel <git@yorhel.nl>2018-03-18 10:43:48 +0100
commitbf40dbdea1913109576ecd06057f4db9263dd2f0 (patch)
tree02ced8b8220343cf4bfadd25a645af512c72f971 /util
parent01a077607067de02c2ae8a2038b50a2a83863f9b (diff)
Fix Docker init script for Mac + add some spacing around vndb-dev-server.pl output
Diffstat (limited to 'util')
-rwxr-xr-xutil/docker-init.sh12
-rwxr-xr-xutil/vndb-dev-server.pl18
2 files changed, 20 insertions, 10 deletions
diff --git a/util/docker-init.sh b/util/docker-init.sh
index b54e513f..9cf07d32 100755
--- a/util/docker-init.sh
+++ b/util/docker-init.sh
@@ -11,10 +11,18 @@ mkdevuser() {
# Create a new user with the same UID and GID as the owner of the VNDB
# directory. This allows for convenient exchange of files without worrying
# about permission stuff.
+ # If the owner is root, we're probably running under Docker for Mac or
+ # similar and don't need to match UID/GID. See https://vndb.org/t9959 #38
+ # to #44.
USER_UID=`stat -c '%u' /var/www`
USER_GID=`stat -c '%g' /var/www`
- groupadd -g $USER_GID devgroup
- useradd -u $USER_UID -g $USER_GID -m -s /bin/bash devuser
+ if test $USER_UID -eq 0; then
+ groupadd devgroup
+ useradd -m -s /bin/bash devuser
+ else
+ groupadd -g $USER_GID devgroup
+ useradd -u $USER_UID -g $USER_GID -m -s /bin/bash devuser
+ fi
# So you can easily do a 'psql -U vndb'
echo '*:*:*:vndb:vndb' >/home/devuser/.pgpass
diff --git a/util/vndb-dev-server.pl b/util/vndb-dev-server.pl
index a712d094..763748b6 100755
--- a/util/vndb-dev-server.pl
+++ b/util/vndb-dev-server.pl
@@ -51,14 +51,16 @@ sub prog_stop {
sub make_run {
- my $cb = run_cmd "make -C $ROOT",
- '>', sub {
- my $d = shift||'';
- return if $d =~ /(Entering|Leaving) directory '\Q$ROOT\E'/;
- return if $d =~ /Nothing to be done for 'all'/;
- print $d;
- };
+ my $newline = 0;
+ my $out = sub {
+ my $d = shift||'';
+ return if !$d || $d =~ /Nothing to be done for 'all'/;
+ print "\n" if !$newline++;
+ print $d;
+ };
+ my $cb = run_cmd "cd $ROOT && make", '>', $out, '2>', $out;
$cb->recv;
+ print "\n" if $newline;
}
@@ -136,7 +138,7 @@ while(1) {
if($needcheck+2 < time) {
make_run;
if(checkmod) {
- print "File has been modified, restarting server.\n";
+ print "\nFile has been modified, restarting server.\n\n";
prog_stop;
prog_start;
} elsif(!$prog) {