Include default installation scripts, as well as ability to symlink a script

This commit is contained in:
Dane Everitt
2017-04-27 16:16:57 -04:00
parent 77b1a258d9
commit 30b4934013
12 changed files with 346 additions and 11 deletions

View File

@@ -63,6 +63,39 @@ class ServiceOption extends Model
return (is_null($this->startup)) ? $this->service->startup : $this->startup;
}
/**
* Returns the install script for the option; if option is copying from another
* it will return the copied script.
*
* @return string
*/
public function getCopyScriptInstallAttribute($value)
{
return (is_null($this->copy_script_from)) ? $this->script_install : $this->copyFrom->script_install;
}
/**
* Returns the entry command for the option; if option is copying from another
* it will return the copied entry command.
*
* @return string
*/
public function getCopyScriptEntryAttribute($value)
{
return (is_null($this->copy_script_from)) ? $this->script_entry : $this->copyFrom->script_entry;
}
/**
* Returns the install container for the option; if option is copying from another
* it will return the copied install container.
*
* @return string
*/
public function getCopyScriptContainerAttribute($value)
{
return (is_null($this->copy_script_from)) ? $this->script_container : $this->copyFrom->script_container;
}
/**
* Gets service associated with a service option.
*
@@ -102,4 +135,9 @@ class ServiceOption extends Model
{
return $this->hasMany(Pack::class, 'option_id');
}
public function copyFrom()
{
return $this->belongsTo(ServiceOption::class, 'copy_script_from');
}
}