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.
Sourcepub fn service_name(
self,
service_name: impl Display,
) -> Spec<Path, Set, TriggerSet, InstallType>
pub fn service_name( self, service_name: impl Display, ) -> Spec<Path, Set, TriggerSet, InstallType>
Name to give the systemd service or cron job
Only needed for install. During uninstall we recognize the service or con job by the special comment service-install leaves at the top of each
pub fn on_schedule( self, schedule: Schedule, ) -> Spec<Path, Name, Set, InstallType>
Sourcepub fn on_boot(self) -> Spec<Path, Name, Set, InstallType>
pub fn on_boot(self) -> Spec<Path, Name, Set, InstallType>
Start the job on boot. When cron is used as init the system needs to be rebooted before this applies
Sourcepub fn description(self, description: impl Display) -> Self
pub fn description(self, description: impl Display) -> Self
The description for the installed service
Sourcepub fn overwrite_existing(self, overwrite: bool) -> Self
pub fn overwrite_existing(self, overwrite: bool) -> Self
Should the installer overwrite existing files? Default is false
Sourcepub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
These args will be shell escaped. If any arguments where already set this adds to them
Sourcepub fn arg(self, arg: impl Into<String>) -> Self
pub fn arg(self, arg: impl Into<String>) -> Self
The argument will be shell escaped. This does not clear previous set arguments but adds to it
Sourcepub fn working_dir(self, dir: PathBuf) -> Self
pub fn working_dir(self, dir: PathBuf) -> Self
The working directory of the program when it is started on a schedule
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, PrepareInstallError>
pub fn prepare_install(self) -> Result<InstallSteps, PrepareInstallError>
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 executed 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 non-existing user.
- no suitable install directory could be found.
- the path for the executable does not point to a file.
Source§impl<M: ToAssign, P: ToAssign, T: ToAssign, I: ToAssign> Spec<M, P, T, I>
impl<M: ToAssign, P: ToAssign, T: ToAssign, I: ToAssign> Spec<M, P, T, I>
Sourcepub fn prepare_remove(self) -> Result<RemoveSteps, PrepareRemoveError>
pub fn prepare_remove(self) -> Result<RemoveSteps, PrepareRemoveError>
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 executed 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.