diff --git a/app/Console/Commands/PanelInstallation.php b/app/Console/Commands/PanelInstallation.php index 1253e657..3712d9f4 100644 --- a/app/Console/Commands/PanelInstallation.php +++ b/app/Console/Commands/PanelInstallation.php @@ -67,7 +67,12 @@ class PanelInstallation extends Command // 初始化数据库 $this->line(' 导入数据库'); - Artisan::call('migrate --seed'); + try { + Artisan::call('migrate --seed'); + } catch (Exception $e) { + Artisan::call('db:wipe'); + abort(500, '导入数据库失败'.$e->getMessage()); + } $this->info('数据库导入完成'); $bar->advance(); diff --git a/install.sh b/install.sh index 6116faca..b190d4a9 100644 --- a/install.sh +++ b/install.sh @@ -55,13 +55,9 @@ check_sys() { #检查composer是否安装 check_composer() { if [ ! -f "/usr/bin/composer" ]; then - if [[ "${release}" == "centos" ]]; then - yum install -y composer - else - apt-get install -y composer - fi + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer else - if [[ $(composer --version | cut -d" " -f3) < 2.2.0 ]]; then + if [[ $(composer -n --version --no-ansi | cut -d" " -f3) < 2.2.0 ]]; then composer self-update fi fi @@ -98,15 +94,16 @@ set_horizon() { if [ ! -f /etc/supervisor/conf.d/horizon.conf ]; then echo " - [program:horizon] - process_name=%(program_name)s - command=php $PWD/artisan horizon - autostart=true - autorestart=true - user=www - redirect_stderr=true - stdout_logfile=$PWD/storage/logs/horizon.log - stopwaitsecs=3600" >>/etc/supervisor/conf.d/horizon.conf + [program:horizon] + process_name=%(program_name)s + command=php $PWD/artisan horizon + autostart=true + autorestart=true + user=www + redirect_stderr=true + stdout_logfile=$PWD/storage/logs/horizon.log + stopwaitsecs=3600" >>/etc/supervisor/conf.d/horizon.conf + supervisorctl reread supervisorctl update supervisorctl start horizon diff --git a/update.sh b/update.sh index 8fc6f89f..a434fa28 100644 --- a/update.sh +++ b/update.sh @@ -21,13 +21,9 @@ check_sys() { #检查composer是否安装 check_composer() { if [ ! -f "/usr/bin/composer" ]; then - if [[ "${release}" == "centos" ]]; then - yum install -y composer - else - apt-get install -y composer - fi + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer else - if [[ $(composer --version | cut -d" " -f3) < 2.2.0 ]]; then + if [[ $(composer -n --version --no-ansi | cut -d" " -f3) < 2.2.0 ]]; then composer self-update fi fi