Struct service_install::install::Spec
source · pub struct Spec<Path, Name, TriggerSet, InstallType>where
Path: ToAssign,
Name: ToAssign,
TriggerSet: ToAssign,
InstallType: ToAssign,{ /* private fields */ }Expand description
The configuration for the current install, needed to perform the
installation or remove an existing one. Create this by using the
install_system or
install_user macros.
Implementations§
source§impl<Path, Name, TriggerSet> Spec<Path, Name, TriggerSet, SystemInstall>where
Path: ToAssign,
Name: ToAssign,
TriggerSet: ToAssign,
impl<Path, Name, TriggerSet> Spec<Path, Name, TriggerSet, SystemInstall>where
Path: ToAssign,
Name: ToAssign,
TriggerSet: ToAssign,
sourcepub fn run_as(self, user: impl Into<String>) -> Self
pub fn run_as(self, user: impl Into<String>) -> Self
Only available for install_system
source§impl<Path, Name, TriggerSet, InstallType> Spec<Path, Name, TriggerSet, InstallType>where
Path: ToAssign,
Name: ToAssign,
TriggerSet: ToAssign,
InstallType: ToAssign,
impl<Path, Name, TriggerSet, InstallType> Spec<Path, Name, TriggerSet, InstallType>where
Path: ToAssign,
Name: ToAssign,
TriggerSet: ToAssign,
InstallType: ToAssign,
pub fn path( self, path: impl Into<PathBuf> ) -> Spec<Set, Name, TriggerSet, InstallType>
sourcepub fn current_exe(
self
) -> Result<Spec<Set, Name, TriggerSet, InstallType>, Error>
pub fn current_exe( self ) -> Result<Spec<Set, Name, TriggerSet, InstallType>, Error>
Install a copy of the currently running exe.
§Errors
Will return an error if the path to the current executable could not be gotten. This can fail for a number of reasons such as filesystem operations and syscall failures.
pub fn name( self, name: impl Display ) -> Spec<Path, Set, TriggerSet, InstallType>
pub fn on_schedule( self, schedule: Schedule ) -> Spec<Path, Name, Set, InstallType>
pub fn on_boot(self) -> Spec<Path, Name, Set, InstallType>
pub fn description(self, description: impl Display) -> Self
pub fn working_dir(self, dir: PathBuf) -> Self
sourcepub fn allowed_inits(self, allowed: impl AsRef<[System]>) -> Self
pub fn allowed_inits(self, allowed: impl AsRef<[System]>) -> Self
By default all supported init systems will be tried Can be set multiple times to try multiple init systems in the order in which this was set.
Note: setting this for an uninstall might cause it to fail
source§impl<T: ToAssign> Spec<Set, Set, Set, T>
impl<T: ToAssign> Spec<Set, Set, Set, T>
sourcepub fn prepare_install(self) -> Result<InstallSteps, InstallError>
pub fn prepare_install(self) -> Result<InstallSteps, InstallError>
Prepare for installing. This makes a number of checks and if they are
passed it returns the InstallSteps. These implement IntoIterator and
can be inspected and executated one by one or executed in one step using
InstallSteps::install.
§Errors
Returns an error if:
- the install is set to be system wide install while not running as admin/superuser
- the service should run as another user then the current one while not running as admin/superuser
- the service should run for a nonexisting user
- no suitable install directory could be found
- the path for the executable does not point to a file
source§impl<P: ToAssign, T: ToAssign, I: ToAssign> Spec<P, Set, T, I>
impl<P: ToAssign, T: ToAssign, I: ToAssign> Spec<P, Set, T, I>
sourcepub fn prepare_remove(self) -> Result<RemoveSteps, RemoveError>
pub fn prepare_remove(self) -> Result<RemoveSteps, RemoveError>
Prepare for removing an install. This makes a number of checks and if
they are passed it returns the RemoveSteps. These implement
IntoIterator and can be inspected and executated one by one or
executed in one step using RemoveSteps::remove.
§Errors
Returns an error if:
- trying to remove a system install while not running as admin/superuser
- no install is found
- anything goes wrong setting up the removal