From 4dcbcc2c06f79a22a08bb91599958518c0bb3faa Mon Sep 17 00:00:00 2001 From: Winfried Kappeler Date: Thu, 28 Mar 2024 22:14:22 +0100 Subject: [PATCH] V0.0.2 InitApp.sh improvements - RoleWorxerSeeder: set of id removed - InitApp.sh improved --- CHANGELOG.md | 7 ++++ app/Models/Word2.php | 21 ----------- database/seeders/RoleWorxerSeeder.php | 4 +-- scripts/InitApp.sh | 51 +++++++++++++++++++-------- 4 files changed, 44 insertions(+), 39 deletions(-) delete mode 100644 app/Models/Word2.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d1b5d5..c9eb208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# V0.0.2 InitApp.sh improvements + +## Changed + +- RoleWorxerSeeder: set of id removed +- InitApp.sh improved + # V0.0.1 ## Added diff --git a/app/Models/Word2.php b/app/Models/Word2.php deleted file mode 100644 index edaaace..0000000 --- a/app/Models/Word2.php +++ /dev/null @@ -1,21 +0,0 @@ -insert([ - 'id' => 5, 'name' => 'Tutor', 'priority' => '30' ]); DB::table('roles')->insert([ - 'id' => 5, 'name' => 'Student', - 'priority' => '30' + 'priority' => '40' ]); } } diff --git a/scripts/InitApp.sh b/scripts/InitApp.sh index 7408251..377a7ca 100755 --- a/scripts/InitApp.sh +++ b/scripts/InitApp.sh @@ -1,37 +1,58 @@ #! /bin/bash function Wait(){ - read answer "OK? Break with Ctrl-C" + echo "OK? Break with Ctrl-C" + read answer } function SeedIt(){ for class in DatabaseSeeder ModuleSeeder SPropertySeeder RoleSeeder UserSeeder \ MenuitemSeeder RoleWorxerSeeder FileSeeder NoteSeeder \ WordSeeder NounSeeder; do - sudo -u www-data ./artisan db:seed --class=$class + sudo -u $DEV_USER ./artisan db:seed --class=$class done } +function CreateStorage(){ + mkdir -p storage/log + if [ ! -d storage/framework/cache ]; then + mkdir -p storage/framework/cache storage/framework/views storage/framework/sessions + fi +} +function LinkLaraknife(){ + if [ ! -L vendor/hamatoma/laraknife ]; then + mkdir -p vendor/hamatoma + ln -sv ../../../laraknife vendor/hamatoma + fi +} function DoIt(){ - sudo composer update - Wait - ./artisan migrate - Wait - SeedIt - Wait - npm run build + # get DEV_USER + . .dev.user + apt update && apt install composer + LinkLaraknife + CreateStorage + Wait + chown -R $DEV_USER:www-data bootstrap/cache + sudo -u $DEV_USER composer update + Wait + sudo -u $DEV_USER ./artisan migrate + Wait + SeedIt + Wait + sudo -u $DEV_USER npm run build } -if [ "$(id -u)" != 0 ]; then - echo "+++ Be root" +if [ ! -d ../laraknife ]; then + echo "+++ missing ../laraknife" + echo "cd .. ; git clone git@github.com:hamatoma/laraknife.git" elif [ ! -e .dev.user ]; then echo "+++ call './Own all' before!" -elif [ ! -d ../laraknife ]; then - echo "+++ missing ../laraknife" - echo "git clone git@github.com:hamatoma/laraknife.git" elif [ ! -f .env ]; then echo "+++ missing .env" echo "cp -a env.example .env" elif [ ! -d /var/lib/mysql/lrvworxer ]; then echo "+++ missing db lrvworxer" echo "sudo mysqladmin create lrvworxer" + echo "echo \"grant all on lrvworxer.* to 'worxer'@'localhost' identified by 'topsecret';\" | sudo mysql mysql" +elif [ "$(id -u)" != 0 ]; then + echo "+++ Be root" else DoIt -fi \ No newline at end of file +fi -- 2.39.5