88 lines
2.8 KiB
Markdown
88 lines
2.8 KiB
Markdown
# shell_sequencer
|
|
|
|
Shell script as wrapper for sequential tasks, such as complex server installations or recurring maintenance tasks.
|
|
|
|
The sequence script (**seq**) containing different steps is separated from the sequence control (**sequencer.sh**). The seq just needs to "include" the sequencer.sh at the end.
|
|
|
|
## sequencer.sh
|
|
|
|
Main sequencer script to be included at the end of a seq.
|
|
|
|
## seqs/
|
|
|
|
Contains sequences (seqs) for different tools, servers or occasions.
|
|
|
|
Sequencer include working on sh and bash.
|
|
|
|
[...]
|
|
. /usr/local/bin/sequencer.sh
|
|
|
|
see seqTemplateExample.sh (which can be generated when calling sequencer.sh directly)
|
|
|
|
## Installation recommendation
|
|
|
|
To make all seqs avaialable to all user, follow the procedure below.
|
|
|
|
Run folloing commands as root:
|
|
|
|
```
|
|
git clone https://winklerfamilie.eu/git/efelon/shell_sequencer.git /opt/sequencer
|
|
ln -s /opt/sequencer/sequencer/sequencer.sh /usr/local/bin
|
|
ln -s /opt/sequencer/seqs /opt
|
|
```
|
|
or
|
|
|
|
use the simple bash installation script in the repository which installs git and performs the steps above:
|
|
|
|
```
|
|
curl -L https://winklerfamilie.eu/git/efelon/shell_sequencer/raw/branch/master/install.sh | bash
|
|
```
|
|
|
|
You may override the default installation path `/opt/sequencer` by appending `-s /custom/path` to the command above:
|
|
|
|
e.g. `curl -L https://winklerfamilie.eu/git/efelon/shell_sequencer/raw/branch/master/install.sh | bash -s /usr/lib/sequencer`
|
|
|
|
## Bash-completion
|
|
|
|
The included optional bash-completion script `sqnall-completion.bash` provides aliases to all available sequences as well as completion for sequencer.sh options and steps (including aliases) individually for each sequence. The aliases have the prefix `sqn_` which stands for _sequence name_.
|
|
|
|
After executing
|
|
|
|
```
|
|
source /opt/sequencer/sqnall-completion.bash
|
|
```
|
|
|
|
e.g. `/opt/sequencer/seqs/kodi.sh` can be started anyhere with `sqn_kodi`
|
|
|
|
### Custom sequence directory
|
|
|
|
To control which seqs are available for bash-completion, copy `sequencer.cfg.dist` to `sequencer.cfg` and adjust the value of the variable `SEQUENCER_USER_SEQS`.
|
|
|
|
To make these changes active run the following commands. You don't need the last step if you already used `installCompletion.sh`.
|
|
|
|
```
|
|
unalias -a
|
|
source ~/.bashrc
|
|
source /opt/sequencer/sqnall-completion.bash
|
|
```
|
|
|
|
or simply logout from the current session and login again.
|
|
|
|
### Automatic setup after login
|
|
|
|
To automatically provide aliases and bash-completion after login, the following bash script needs to be executed once for each user separately:
|
|
|
|
```
|
|
source /opt/sequencer/installCompletion.sh
|
|
```
|
|
|
|
This sources the bash-completion script in the users .bashrc file.
|
|
|
|
## Default text editor
|
|
|
|
Sequencer uses the Debian alternatives system to select which editor to use. To change the default editor, which by default is most likely _nano_:
|
|
|
|
```
|
|
update-alternatives --config editor
|
|
```
|