+#! /bin/bash
+BASE=lib/meta
+function Create(){
+ local base=$1
+ local back=$2
+ cd $base
+ local modules=
+ for file in *; do
+ if [ $file != 'modules.dart' -a $file != 'module_meta_data.dart' ]; then
+ local module=${file/_meta.dart/}
+ modules="$modules $module"
+ fi
+ done
+ cd $back
+ local fileSql=/tmp/rest_server.init.sql
+ echo "-- created from CreateInitialSql, $(date '+%Y.%m.%d %H:%M')" >$fileSql
+ for module in $modules; do
+ module2=$(echo ${module:0:1} | tr a-z A-Z)${module:1}
+ echo "== $module2"
+ ./Meta show-table $module2 >>$fileSql
+ done
+ cat <<EOS >>$fileSql
+insert into roles (role_id, role_name, role_createdat, role_createdby) values
+ (10, 'Administrator', NOW(), 'install'),
+ (20, 'Verwalter', NOW(), 'install'),
+ (30, 'Benutzer', NOW(), 'install'),
+ (90, 'Gast', NOW(), 'install');
+insert into users (user_id, user_name, user_displayname, user_email, user_role, user_createdat, user_createdby) values
+ (1, 'Administrator', 'Admin', 'admin@hamatoma.de', 10, NOW(), 'install'),
+ (2, 'Hamatoma', 'Hamatoma', 'hm@hamatoma.de', 10, NOW(), 'install');
+insert into starters (starter_id, starter_name, starter_route, starter_icon, starter_createdat, starter_createdby) values
+ (1, 'roles', 'roles/list', '', NOW(), 'install'),
+ (2, 'users', 'users/list', '', NOW(), 'install'),
+ (3, 'structures', 'structures/list', '', NOW(), 'install'),
+ (4, 'benchmark', 'benchmark/list', '', NOW(), 'install');
+EOS
+ ls -ld $fileSql
+}
+if [ ! -d $BASE ]; then
+ echo "+++ wrong current dir: missing lib/meta"
+else
+ Create $BASE "../.."
+fi
\ No newline at end of file