preparation for verbose output of shell commands (called by function exe())
This commit is contained in:
@@ -10,20 +10,20 @@ giteaServiceLoc="/etc/systemd/system/gitea.service"
|
||||
|
||||
step_1_info() { echo "Updating apt"; }
|
||||
step_1() {
|
||||
apt update
|
||||
exe apt update
|
||||
}
|
||||
|
||||
step_2_info() { echo "Downloading $toolName to user home: $giteaDownload"; }
|
||||
step_2() {
|
||||
cd
|
||||
wget -O gitea $giteaDownload
|
||||
exe cd ~
|
||||
exe wget -O gitea $giteaDownload
|
||||
saveReturn $?
|
||||
endReturn
|
||||
}
|
||||
|
||||
step_3_info() { echo "Adding user for $toolName (git:git)"; }
|
||||
step_3() {
|
||||
adduser \
|
||||
exe adduser \
|
||||
--system \
|
||||
--shell /bin/bash \
|
||||
--gecos 'Git Version Control' \
|
||||
@@ -38,14 +38,14 @@ step_3() {
|
||||
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/
|
||||
exe chown -R git: /var/lib/gitea/
|
||||
exe chmod -R 750 /var/lib/gitea/
|
||||
mkdir /etc/gitea
|
||||
chown root:git /etc/gitea
|
||||
chmod 770 /etc/gitea
|
||||
exe chown root:git /etc/gitea
|
||||
exe chmod 770 /etc/gitea
|
||||
echo "Copying gitea to global location and making it executable"
|
||||
chmod +x ~/gitea
|
||||
cp ~/gitea /usr/local/bin/gitea
|
||||
exe chmod +x ~/gitea
|
||||
exe cp ~/gitea /usr/local/bin/gitea
|
||||
saveReturn $?
|
||||
endReturn
|
||||
}
|
||||
@@ -60,8 +60,8 @@ step_5() {
|
||||
|
||||
step_6_info() { echo -e "Starting $toolName service\n"; }
|
||||
step_6() {
|
||||
systemctl enable gitea
|
||||
systemctl start gitea
|
||||
exe systemctl enable gitea
|
||||
exe systemctl start gitea
|
||||
echo "Before proceeding to installation you may need to create a database first with step 10"
|
||||
echo
|
||||
echo "Goto http://[yourip]:3000/install and complete installation"
|
||||
@@ -77,17 +77,17 @@ step_10() {
|
||||
local mysqlPass
|
||||
|
||||
echo "Existing mysql databases:"
|
||||
mysql -u root -e 'SHOW DATABASES;'
|
||||
exe mysql -u root -e 'SHOW DATABASES;'
|
||||
|
||||
echo -en "Enter database name: "
|
||||
read mysqlDatabase
|
||||
endCheckEmpty mysqlDatabase "database name"
|
||||
mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
|
||||
exe mysql -u root -e 'CREATE DATABASE '$mysqlDatabase' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
|
||||
saveReturn $?
|
||||
endReturn
|
||||
|
||||
echo "Existing mysql user:"
|
||||
mysql -u root -e 'SELECT User, Host FROM mysql.user;'
|
||||
exe mysql -u root -e 'SELECT User, Host FROM mysql.user;'
|
||||
echo -en "Enter mysql user name: "
|
||||
read mysqlUser
|
||||
endCheckEmpty mysqlDatabase "user name"
|
||||
@@ -95,21 +95,21 @@ step_10() {
|
||||
echo -en "Enter mysql user password: "
|
||||
read mysqlPass
|
||||
endCheckEmpty mysqlPass "password"
|
||||
mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
|
||||
exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
|
||||
saveReturn $?
|
||||
endReturn
|
||||
|
||||
mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
|
||||
exe mysql -u root -e 'GRANT ALL PRIVILEGES ON '$mysqlDatabase'.* TO '"'"$mysqlUser"'"'@'"'"'localhost'"'"';'
|
||||
saveReturn $?
|
||||
endReturn
|
||||
|
||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||
exe mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||
}
|
||||
|
||||
step_20_info() { echo "Secure settings after installation"; }
|
||||
step_20() {
|
||||
chmod 750 /etc/gitea
|
||||
chmod 644 /etc/gitea/app.ini
|
||||
exe chmod 750 /etc/gitea
|
||||
exe chmod 644 /etc/gitea/app.ini
|
||||
}
|
||||
|
||||
# Sequence Revision
|
||||
|
Reference in New Issue
Block a user