mirror of
https://github.com/torrentpier/autoinstall.git
synced 2025-02-28 15:10:55 +03:00
Some minor improvements (#4)
* Some minor improvements * Create .gitignore * Updated * Update install.sh * Update apt.install.sh * Update apt.install.sh * Update apt.install.sh * Update apt.install.sh * Update apt.install.sh * Update apt.install.sh
This commit is contained in:
parent
ab995bb97a
commit
db927f4a85
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# EditorConfig helps developers define and maintain consistent
|
||||||
|
# coding styles between different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{diff,md}]
|
||||||
|
trim_trailing_whitespace = false
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.idea
|
@ -17,6 +17,10 @@ suppOs=("debian" "ubuntu")
|
|||||||
currOs=$(grep ^ID /etc/os-release | awk -F= '{print $2}')
|
currOs=$(grep ^ID /etc/os-release | awk -F= '{print $2}')
|
||||||
logsInst="/var/log/torrentpier_install.log"
|
logsInst="/var/log/torrentpier_install.log"
|
||||||
|
|
||||||
|
# TorrentPier auth
|
||||||
|
torrentPierUser="admin"
|
||||||
|
torrentPierPass="admin"
|
||||||
|
|
||||||
# User verification
|
# User verification
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if [ "$(whoami)" != "root" ]; then
|
||||||
echo "It needs to be run under the root user!" 2>&1 | tee -a "$logsInst"
|
echo "It needs to be run under the root user!" 2>&1 | tee -a "$logsInst"
|
||||||
@ -79,7 +83,7 @@ if $foundOs; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Configuration file nginx for torrentpier
|
# NGINX configuration file for TorrentPier
|
||||||
nginx_torrentpier="server {
|
nginx_torrentpier="server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name $HOST;
|
server_name $HOST;
|
||||||
@ -106,7 +110,7 @@ if $foundOs; then
|
|||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# Configuration file nginx for phpmyadmin
|
# NGINX configuration file for phpMyAdmin
|
||||||
nginx_phpmyadmin="server {
|
nginx_phpmyadmin="server {
|
||||||
listen 9090;
|
listen 9090;
|
||||||
server_name $HOST;
|
server_name $HOST;
|
||||||
@ -135,7 +139,7 @@ if $foundOs; then
|
|||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# Packages for installation, torrentpier, phpmyadmin
|
# Packages for installation, TorrentPier, phpMyAdmin
|
||||||
pkgsList=("php-fpm" "php-mbstring" "php-bcmath" "php-intl" "php-tidy" "php-xml" "php-xmlwriter" "php-zip" "php-gd" "php-json" "php-curl" "nginx" "mariadb-server" "pwgen" "jq" "curl" "zip" "unzip" "cron")
|
pkgsList=("php-fpm" "php-mbstring" "php-bcmath" "php-intl" "php-tidy" "php-xml" "php-xmlwriter" "php-zip" "php-gd" "php-json" "php-curl" "nginx" "mariadb-server" "pwgen" "jq" "curl" "zip" "unzip" "cron")
|
||||||
|
|
||||||
# Updating tables and packages
|
# Updating tables and packages
|
||||||
@ -153,7 +157,7 @@ if $foundOs; then
|
|||||||
apt-get install -y sudo 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
apt-get install -y sudo 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Package installation сycle
|
# Package installation cycle
|
||||||
for package in "${pkgsList[@]}"; do
|
for package in "${pkgsList[@]}"; do
|
||||||
# Checking for packages and installing packages
|
# Checking for packages and installing packages
|
||||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||||
@ -172,7 +176,7 @@ if $foundOs; then
|
|||||||
# Installation phpMyAdmin
|
# Installation phpMyAdmin
|
||||||
if ! dpkg-query -W -f='${Status}' "phpmyadmin" 2>/dev/null | grep -q "install ok installed"; then
|
if ! dpkg-query -W -f='${Status}' "phpmyadmin" 2>/dev/null | grep -q "install ok installed"; then
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo "phpmyadmin not installed. Installation in progress..." | tee -a "$logsInst"
|
echo "phpMyAdmin not installed. Installation in progress..." | tee -a "$logsInst"
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
|
|
||||||
sudo debconf-set-selections <<EOF
|
sudo debconf-set-selections <<EOF
|
||||||
@ -190,7 +194,7 @@ EOF
|
|||||||
sudo systemctl restart nginx 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo systemctl restart nginx 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
else
|
else
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo "phpmyadmin is already installed on the system. The installation cannot continue." | tee -a "$logsInst"
|
echo "phpMyAdmin is already installed on the system. The installation cannot continue." | tee -a "$logsInst"
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
read -rp "Press Enter to complete..."
|
read -rp "Press Enter to complete..."
|
||||||
exit 1
|
exit 1
|
||||||
@ -204,15 +208,15 @@ EOF
|
|||||||
curl -sSL https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
curl -sSL https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Installation torrentpier
|
# Installation TorrentPier
|
||||||
if [ ! -d "/var/www/torrentpier" ]; then
|
if [ ! -d "/var/www/torrentpier" ]; then
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo "torrentpier not installed. Installation in progress..." | tee -a "$logsInst"
|
echo "TorrentPier not installed. Installation in progress..." | tee -a "$logsInst"
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
# Creating a temporary directory
|
# Creating a temporary directory
|
||||||
sudo mkdir -p /tmp/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo mkdir -p /tmp/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
|
|
||||||
# Downloading torrentpier
|
# Downloading TorrentPier
|
||||||
curl -s https://api.github.com/repos/torrentpier/torrentpier/releases | jq -r 'map(select(.prerelease == false)) | .[0].zipball_url' | xargs -n 1 curl -L -o /tmp/torrentpier/torrentpier.zip 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
curl -s https://api.github.com/repos/torrentpier/torrentpier/releases | jq -r 'map(select(.prerelease == false)) | .[0].zipball_url' | xargs -n 1 curl -L -o /tmp/torrentpier/torrentpier.zip 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
sudo unzip -o /tmp/torrentpier/torrentpier.zip -d /tmp/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo unzip -o /tmp/torrentpier/torrentpier.zip -d /tmp/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
sudo mv /tmp/torrentpier/torrentpier-torrentpier-* /var/www/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo mv /tmp/torrentpier/torrentpier-torrentpier-* /var/www/torrentpier 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
@ -248,7 +252,7 @@ EOF
|
|||||||
{ (sudo crontab -l; echo "* * * * * php /var/www/torrentpier/cron.php") | sudo crontab -; } 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
{ (sudo crontab -l; echo "* * * * * php /var/www/torrentpier/cron.php") | sudo crontab -; } 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
else
|
else
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo "torrentpier is already installed on the system. The installation cannot continue." | tee -a "$logsInst"
|
echo "TorrentPier is already installed on the system. The installation cannot continue." | tee -a "$logsInst"
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
read -rp "Press Enter to complete..."
|
read -rp "Press Enter to complete..."
|
||||||
exit 1
|
exit 1
|
||||||
@ -262,9 +266,9 @@ EOF
|
|||||||
# Setting up nginx
|
# Setting up nginx
|
||||||
if dpkg-query -W -f='${Status}' "nginx" 2>/dev/null | grep -q "install ok installed"; then
|
if dpkg-query -W -f='${Status}' "nginx" 2>/dev/null | grep -q "install ok installed"; then
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo "nginx is not configured. The setup in progress..." | tee -a "$logsInst"
|
echo "NGINX is not configured. The setup in progress..." | tee -a "$logsInst"
|
||||||
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo "===================================" 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
# We remove the default one and create the torrentpier config
|
# We remove the default one and create the TorrentPier config
|
||||||
sudo rm /etc/nginx/sites-enabled/default 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo rm /etc/nginx/sites-enabled/default 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
echo -e "$nginx_torrentpier" | sudo tee /etc/nginx/sites-available/01-torrentpier.conf 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
echo -e "$nginx_torrentpier" | sudo tee /etc/nginx/sites-available/01-torrentpier.conf 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
sudo ln -s /etc/nginx/sites-available/01-torrentpier.conf /etc/nginx/sites-enabled/ 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
sudo ln -s /etc/nginx/sites-available/01-torrentpier.conf /etc/nginx/sites-enabled/ 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
@ -281,16 +285,16 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
echo "Link to torrentpier: http://$HOST/"
|
echo "Link to your TorrentPier website: http://$HOST/"
|
||||||
echo "User: admin"
|
echo "User: $torrentPierUser"
|
||||||
echo "Password: admin"
|
echo "Password: $torrentPierPass"
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
echo "Link to torrentpier: http://$HOST:9090/phpmyadmin"
|
|
||||||
echo "Database: $dbSql"
|
echo "Database: $dbSql"
|
||||||
echo "User to database: $userSql"
|
echo "User to database: $userSql"
|
||||||
echo "Password to atabase: $passSql"
|
echo "Password to database: $passSql"
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
echo "Password to phpmyadmin: $passPma"
|
echo "Link to phpMyAdmin: http://$HOST:9090/phpmyadmin"
|
||||||
|
echo "Password to phpMyAdmin: $passPma"
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
else
|
else
|
||||||
echo "Your system is not supported." 2>&1 | tee -a "$logsInst"
|
echo "Your system is not supported." 2>&1 | tee -a "$logsInst"
|
||||||
|
@ -55,7 +55,7 @@ if $foundOs; then
|
|||||||
apt-get install -y sudo 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
apt-get install -y sudo 2>&1 | sudo tee -a "$logsInst" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Package installation сycle
|
# Package installation cycle
|
||||||
for package in "${pkgsList[@]}"; do
|
for package in "${pkgsList[@]}"; do
|
||||||
# Checking for packages and installing packages
|
# Checking for packages and installing packages
|
||||||
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user