initial commit
This commit is contained in:
146
SimpleInstall.sh
Normal file
146
SimpleInstall.sh
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
#############################
|
||||||
|
# SingleModuleInstaller #
|
||||||
|
#############################
|
||||||
|
|
||||||
|
|
||||||
|
##-----------------##
|
||||||
|
# Defining Vars #
|
||||||
|
##-----------------##
|
||||||
|
|
||||||
|
#SMI specific Vars
|
||||||
|
SMI_config=no
|
||||||
|
SMI_ModuleName=<ModuleName>
|
||||||
|
|
||||||
|
#Enforcing Legacy Mode
|
||||||
|
APTMODE="apt"
|
||||||
|
OUTPUT='/dev/tty'
|
||||||
|
IMODE=l
|
||||||
|
|
||||||
|
#PackageManager-config
|
||||||
|
|
||||||
|
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
|
||||||
|
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
|
||||||
|
|
||||||
|
if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then
|
||||||
|
echo "Ubuntu 18.04 Detected"
|
||||||
|
PKGM="$APTMODE"
|
||||||
|
PKGI="${PKGM} install -y --no-install-recommends"
|
||||||
|
PKGLIST="apt"
|
||||||
|
shortdist=ubu1804
|
||||||
|
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
|
||||||
|
echo "Ubuntu 20.04 Detected"
|
||||||
|
PKGM="$APTMODE"
|
||||||
|
PKGI="${PKGM} install -y --no-install-recommends"
|
||||||
|
PKGLIST="apt"
|
||||||
|
echo "This os in not supported"
|
||||||
|
exit
|
||||||
|
shortdist=ubu2004
|
||||||
|
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
|
||||||
|
echo "Debian 10 Detected"
|
||||||
|
PKGM="$APTMODE"
|
||||||
|
PKGI="${PKGM} install -y --no-install-recommends"
|
||||||
|
PKGLIST="apt"
|
||||||
|
shortdist=deb10
|
||||||
|
echo "This os in not supported"
|
||||||
|
exit
|
||||||
|
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
|
||||||
|
echo "Centos 8 Detected"
|
||||||
|
PKGM="dnf"
|
||||||
|
PKGI="${PKGM} install --setopt=install_weak_deps=False --best -y"
|
||||||
|
PKGLIST="dnf"
|
||||||
|
shortdist=cent8
|
||||||
|
echo "This os in not supported"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
echo "This os in not supported"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset dist_ver dist APTMODE
|
||||||
|
|
||||||
|
|
||||||
|
#Repo Vars
|
||||||
|
repo=<Put your repo here https://git.ictmaatwerk.com/user/MyAwesomeModule>
|
||||||
|
branch=<branchname>
|
||||||
|
branchtype=branch
|
||||||
|
|
||||||
|
#SelfBuilding Vars
|
||||||
|
PKGI="${PKGM} install -y"
|
||||||
|
mtype=""$repo"/raw/"$branchtype"/"$branch""
|
||||||
|
|
||||||
|
|
||||||
|
##---------------##
|
||||||
|
# Functions #
|
||||||
|
##---------------##
|
||||||
|
|
||||||
|
msg () {
|
||||||
|
echo "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
#Checking if Config var has been set
|
||||||
|
if [ $SMI_config = no ]; then
|
||||||
|
msg " Script is not configured"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
##--------------------------##
|
||||||
|
# Installer-Requirements #
|
||||||
|
##--------------------------##
|
||||||
|
|
||||||
|
msg " Starting installer" 8 78
|
||||||
|
$PKGM update > $OUTPUT 2>&1
|
||||||
|
$PKGI curl > $OUTPUT 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
##-------------------------##
|
||||||
|
# Generating APT list #
|
||||||
|
##-------------------------##
|
||||||
|
#General aptList
|
||||||
|
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/generic.pkg.list; then
|
||||||
|
curl "$mtype"/generic.pkg.list >>/tmp/pkg.list
|
||||||
|
fi
|
||||||
|
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/"$PKGLIST".pkg.list; then
|
||||||
|
curl "$mtype"/"$PKGLIST".pkg.list >>/tmp/pkg.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
##--------------------##
|
||||||
|
# Pre-Requirements #
|
||||||
|
##--------------------##
|
||||||
|
|
||||||
|
msg " Preconfiguring"
|
||||||
|
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
|
||||||
|
$PKGM update
|
||||||
|
$PKGM upgrade -y
|
||||||
|
|
||||||
|
|
||||||
|
##-------------------##
|
||||||
|
# Pre-configuring #
|
||||||
|
##-------------------##
|
||||||
|
|
||||||
|
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/preconf.sh; then
|
||||||
|
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/preconf.sh)
|
||||||
|
fi
|
||||||
|
|
||||||
|
##-------------##
|
||||||
|
# Installer #
|
||||||
|
##-------------##
|
||||||
|
|
||||||
|
$PKGM update
|
||||||
|
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
||||||
|
cat /tmp/pkg.list | xargs $PKGI
|
||||||
|
|
||||||
|
|
||||||
|
##---------------##
|
||||||
|
# Configuring #
|
||||||
|
##---------------##
|
||||||
|
|
||||||
|
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/conf.sh; then
|
||||||
|
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/conf.sh)
|
||||||
|
fi
|
||||||
|
|
||||||
|
##-------##
|
||||||
|
# end #
|
||||||
|
##-------##
|
||||||
|
|
||||||
|
msg " Done!"
|
||||||
1
apt.pkg.list
Normal file
1
apt.pkg.list
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Package list for distro's using APT as package manager, remove this line and seperate packages using a space example:(htop nload)
|
||||||
2
conf.sh
Normal file
2
conf.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This script will be run after package manager installs packages
|
||||||
|
echo "running conf.sh"
|
||||||
1
conf/readme.md
Normal file
1
conf/readme.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Put your config files here
|
||||||
1
dnf.pkg.list
Normal file
1
dnf.pkg.list
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Package list for distro's using DNF as package manager, remove this line and seperate packages using a space example: (htop nload)
|
||||||
1
generic.pkg.list
Normal file
1
generic.pkg.list
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Package list for all distro's, remove this line and seperate packages using a space example:(htop nload)
|
||||||
2
preconf.sh
Normal file
2
preconf.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This script will be run before package manager installs packages
|
||||||
|
echo "running preconf.sh"
|
||||||
15
readme.md
Normal file
15
readme.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# SimpleInstall (based on Web-V2)
|
||||||
|
|
||||||
|
## Easily create a install script for Linux
|
||||||
|
|
||||||
|
|
||||||
|
### File Explanation
|
||||||
|
| File Name | Description |
|
||||||
|
| -------- | ------------ |
|
||||||
|
| SimpleInstall.sh | Main install script |
|
||||||
|
| preconf.sh | Pre config script runs before installing packages form *.pkg.list |
|
||||||
|
| conf.sh| Configuration script runs after installing packages form *.pkg.list |
|
||||||
|
| generic.pkg.list | packagelist all distro's |
|
||||||
|
| 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 |
|
||||||
Reference in New Issue
Block a user