From e1207b1a50de406d3aa5dff2eed53f27ead520db Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Wed, 30 Sep 2020 13:03:41 +0200 Subject: [PATCH] Added documentation for os handeling --- readme.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/readme.md b/readme.md index e6ada81..b75821d 100644 --- a/readme.md +++ b/readme.md @@ -13,3 +13,33 @@ | apt.pkg.list | packagelist for distro's that use apt | | dnf.pkg.list | packagelist for distro's that use dnf/yum | | 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 +```