Added documentation for os handeling

This commit is contained in:
Bram Prieshof
2020-09-30 13:03:41 +02:00
parent a555b772ff
commit e1207b1a50

View File

@@ -13,3 +13,33 @@
| apt.pkg.list | packagelist for distro's that use apt | | apt.pkg.list | packagelist for distro's that use apt |
| dnf.pkg.list | packagelist for distro's that use dnf/yum | | dnf.pkg.list | packagelist for distro's that use dnf/yum |
| config/* | Directory for config files | | config/* | Directory for config files |
## OS Handeling in preconf and conf.sh
### Run a single command based on OS
Example: Centos 8
```
if [ "$shortdist" = "cent8" ]; then
echo "i run when Centos 8 is detected"
fi
```
### Run commands for mutiple OS's
Example: Debian 10, Ubuntu 18.04 or Ubuntu 20.04
```
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
echo "i run when Ubuntu 18.04/20.04 or debian 10 is detected"
fi
```
### Run diffrent commands based on OS
Example: run Command1 if Debian 10 is detected and run Command2 if Centos 8 is detected
```
if [ "$shortdist" = "deb10" ] ; then
echo "Command1: i debian 10 is detected"
elif [ "$shortdist" = "cent8" ]; then
echo "Command2: i run when Centos 8 is detected"
fi
```