Step help as own function within step definition script

fixes #1
This commit is contained in:
2019-04-05 12:06:47 +01:00
parent bfccac6b28
commit 17eaeee234
4 changed files with 107 additions and 120 deletions

View File

@@ -8,21 +8,21 @@ giteaDownload="https://dl.gitea.io/gitea/1.7.5/gitea-1.7.5-linux-arm-7"
giteaService="https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service"
giteaServiceLoc="/etc/systemd/system/gitea.service"
function step_1 {
echo -e "Updating apt\n"
step_1_info() { echo "Updating apt"; }
step_1() {
apt update
}
function step_2 {
echo -e "Downloading $toolName to user home: $giteaDownload\n"
step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; }
step_2() {
cd
wget -O gitea $giteaDownload
saveReturn $?
endReturn
}
function step_3 {
echo -e "Adding user for $toolName (git:git)"
step_3_info() { echo "Adding user for $toolName (git:git)"; }
step_3() {
adduser \
--system \
--shell /bin/bash \
@@ -35,8 +35,8 @@ function step_3 {
endReturn
}
function step_4 {
echo -e "Create required directory structure"
step_4_info() { echo "Create required directory structure"; }
step_4() {
mkdir -p /var/lib/gitea/{custom,data,log}
chown -R git: /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
@@ -50,16 +50,16 @@ function step_4 {
endReturn
}
function step_5 {
echo -e "Creating systemd service"
step_5_info() { echo "Creating systemd service"; }
step_5() {
wget -O $giteaServiceLoc $giteaService
echo -en "Uncomment needed services (enter to continue): "
echo -en "Uncomment needed services mysql (enter to continue): "
read
vi $giteaServiceLoc
}
function step_6 {
echo -e "Starting $toolName service"
step_6_info() { echo -e "Starting $toolName service\n"; }
step_6() {
systemctl enable gitea
systemctl start gitea
echo "Before proceeding to installation you may need to create a database first with step 10"
@@ -70,13 +70,12 @@ function step_6 {
}
function step_10 {
step_10_info() { echo -e "Create mysql database for $toolName\n"; }
step_10() {
local mysqlDatabase
local mysqlUser
local mysqlPass
echo "Setup mysql database"
echo "Existing mysql databases:"
mysql -u root -e 'SHOW DATABASES;'
@@ -107,28 +106,11 @@ function step_10 {
mysql -u root -e 'FLUSH PRIVILEGES;'
}
function step_20 {
echo -e "Secure settings after installation"
step_20_info() { echo "Secure settings after installation"; }
step_20() {
chmod 750 /etc/gitea
chmod 644 /etc/gitea/app.ini
}
help() {
echo " $toolName Documentation"
echo " 1: Updating apt"
echo " 2: Downloading $toolName to user home: $giteaDownload"
echo " 3: Adding user for $toolName (git:git)"
echo " 4: Create required directory structure"
echo " 5: Creating systemd service"
echo " 6: Starting $toolName service"
echo
echo " 10: Setup mysql database"
echo
echo " 20: Secure settings after installation"
echo
}
#
## Path to sequencer
# Path to sequencer
. ../sequencer/sequencer.sh