--- /dev/null
+#!/usr/bin/env sh
+#####################################################################
+#
+# Compile, update source code
+# Called by cron/etc/nb
+#
+#####################################################################
+set -e
+. $(dirname "$0")/../etc/profile || exit 1; [ -z "$NB_ROOT" ] && exit
+
+cd $NB_ROOT || exit
+
+share/db/update.sh
+
+which docker 1> /dev/null && docker run --rm -v $NB_ROOT:$NB_ROOT alpine sh -c "(. $NB_ROOT/etc/profile && nb_repos) >/dev/null && echo Docker: OK"
+
+#--------------------------------------------------------------------------------
#
# etc/profile
#
+# To test:
# docker run --rm -it -v $NB_ROOT:$NB_ROOT alpine sh -c " . $NB_ROOT/etc/profile --debug && nb_repos && echo OK"
#
+#
+#--------------------------------------------------------------------------------
[ "$1" = "--debug" ] && export NB_DEBUG="echo DEBUG: " && shift
#
#!/usr/bin/env bash --login
set -e
cd "$(dirname "$0")"
-
-echo "Update sys.shell_function"
-
(
cat << EOF
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
-EOF
-shell_functions2sql shell_function
+SELECT 'Update sys.shell_function';
+`shell_functions2sql shell_function`
-cat << EOF
COMMIT;
EOF
) | sqlite3 sys.db
+IFS=$'\n'
+for f in $(grep -lrI SHELL_REPLACE $NB_ROOT); do
+
+ echo "Update $f"
+ shell_replace -i "$f"
+done