mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2024-11-10 02:14:12 +00:00
Supressing confirmations in install script
This commit is contained in:
parent
00a209eb7a
commit
9bcb976a89
3 changed files with 14 additions and 11 deletions
|
@ -12,8 +12,8 @@ cd $SCRIPT_DIR && touch "database.sqlite"
|
|||
printf "${GREEN}Creating your environment file${BLACK}\n"
|
||||
cd $SCRIPT_DIR && cp ".env.example" ".env"
|
||||
|
||||
cd $SCRIPT_DIR && ./lancache-autofill app:initialise-database
|
||||
cd $SCRIPT_DIR && ./lancache-autofill app:initialise-database --yes
|
||||
|
||||
cd $SCRIPT_DIR && ./lancache-autofill steam:update-app-list
|
||||
|
||||
cd $SCRIPT_DIR && ./lancache-autofill steam:initialise
|
||||
cd $SCRIPT_DIR && ./lancache-autofill steam:initialise --yes
|
|
@ -12,7 +12,8 @@ class InitialiseDatabase extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:initialise-database';
|
||||
protected $signature = 'app:initialise-database
|
||||
{--yes : Suppress confirmations}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -29,7 +30,7 @@ class InitialiseDatabase extends Command
|
|||
public function handle()
|
||||
{
|
||||
if (Capsule::schema()->hasTable('steam_apps') OR Capsule::schema()->hasTable('steam_queue') OR Capsule::schema()->hasTable('steam_accounts')) {
|
||||
if ($this->confirm('Are you sure you wish to clear all data in the database?')) {
|
||||
if ($this->option('yes') OR $this->confirm('Are you sure you wish to clear all data in the database?')) {
|
||||
$this->info('Removing existing database tables');
|
||||
Capsule::schema()->dropIfExists('steam_apps');
|
||||
Capsule::schema()->dropIfExists('steam_queue');
|
||||
|
|
|
@ -12,7 +12,8 @@ class Initialise extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'steam:initialise';
|
||||
protected $signature = 'steam:initialise
|
||||
{--yes : Suppress confirmations}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -37,19 +38,20 @@ class Initialise extends Command
|
|||
{
|
||||
$steamCmdDirectory = dirname(getenv('STEAMCMD_PATH'));
|
||||
|
||||
if ($this->confirm('Are you sure you wish to initialise SteamCMD"? This will remove the directory "'.$steamCmdDirectory.'"')) {
|
||||
if ($this->option('yes') OR $this->confirm('Are you sure you wish to initialise SteamCMD"? This will remove the directory "' . $steamCmdDirectory . '"')) {
|
||||
|
||||
$process['remove'] = new Process('rm -rf '.$steamCmdDirectory);
|
||||
$process['create'] = new Process('mkdir -p '.$steamCmdDirectory.' && cd '.$steamCmdDirectory.' && curl -sqL "'.self::STEAMCMD_URL.'" | tar zxvf -');
|
||||
$process['run'] = new Process('unbuffer '.getenv('STEAMCMD_PATH').' +login anonymous +quit');
|
||||
$this->info('Initialising SteamCMD');
|
||||
|
||||
$process['remove'] = new Process('rm -rf ' . $steamCmdDirectory);
|
||||
$process['create'] = new Process('mkdir -p ' . $steamCmdDirectory . ' && cd ' . $steamCmdDirectory . ' && curl -sqL "' . self::STEAMCMD_URL . '" | tar zxvf -');
|
||||
$process['run'] = new Process('unbuffer ' . getenv('STEAMCMD_PATH') . ' +login anonymous +quit');
|
||||
|
||||
foreach ($process as $process) {
|
||||
$process->run(function ($type, $buffer) {
|
||||
|
||||
if (Process::ERR === $type) {
|
||||
$this->error(str_replace(["\r", "\n"], '', $buffer));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->line(str_replace(["\r", "\n"], '', $buffer));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue