forked from maxexcloo/Minstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minstall.sh
executable file
·89 lines (80 loc) · 1.63 KB
/
minstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Script Initialisation Functions
# Default Distribution
DISTRIBUTION=none
# Default Module
MODULE=none
# Libraries Path
LIBRARYPATH=libraries
# Module Path
MODULEPATH=modules
# Loop Through Libraries
for file in $LIBRARYPATH/*.sh; do
# Source Scripts
source $file
done
# Check Distribution
if [ $DISTRIBUTION = 'none' ]; then
# Print Distribution Not Supported Message
warning "Your distribution is unsupported!"
fi
# Load Distribution Specific Libraries
for file in $LIBRARYPATH/platforms/*.$DISTRIBUTION.sh; do
# Check Distribution
if [ $DISTRIBUTION != 'none' ]; then
# Source Scripts
source $file
fi
done
# Print Help If No Parameters Are Specified
if [ $# == 0 ]; then
# Load Module Listing Script
source $MODULEPATH/help-modules.sh
# Exit
exit
fi
# Loop Through Parameters
while [ $# -ne 0 ]; do
# Set Current Module Variable
MODULE=$1
# Check Parameters Against Known Scripts
case $1 in
# Help Function
help)
# Load Help Script
source $MODULEPATH/help.sh
# Exit
exit
;;
# Module Listing Function
modules)
# Load Module Listing Script
source $MODULEPATH/help-modules.sh
# Exit
exit
;;
# Load Scripts
*)
# Check If Module Exists
if [ -f $MODULEPATH/$1.sh ]; then
# Print Module Description
header $(describe $MODULEPATH/$1.sh)
# Load Module
source $MODULEPATH/$1.sh
# Module Doesn't Exist
else
# Ask If User Wants To Abort
if question --default yes "Module $1 not found. Do you want to abort? (Y/n)"; then
# Print Message
error "Aborted!"
# Exit Script
exit
fi
fi
echo ""
;;
esac
# Shift Variables
shift
done
final