Compare commits

..

No commits in common. "ee6442e39d6a3fcf051d9113c0143693fa6cacc4" and "bf892863830eb1c22a537eb334d63beca1c5fc70" have entirely different histories.

2 changed files with 27 additions and 24 deletions

View File

@ -1,9 +1,10 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Nícolas Pastorello (opastorello)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Author: kristocopani
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://semaphoreui.com/
# App Default Values
APP="GLPI"
@ -36,7 +37,12 @@ function update_script() {
RELEASE=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}"
#Auto update under development
cd /opt
wget -q https://github.com/semaphoreui/semaphore/releases/download/v${RELEASE}/semaphore_${RELEASE}_linux_amd64.deb
dpkg -i semaphore_${RELEASE}_linux_amd64.deb &>/dev/null
echo "${RELEASE}" >"/opt/${APP}_version.txt"
msg_ok "Updated ${APP} to v${RELEASE}"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi

View File

@ -2,7 +2,8 @@
#Copyright (c) 2021-2025 community-scripts ORG
# Author: Nícolas Pastorello (opastorello)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
@ -34,12 +35,6 @@ mysql -u root -e "CREATE DATABASE $DB_NAME;"
mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
mysql -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost';"
mysql -u root -e "GRANT SELECT ON \`mysql\`.\`time_zone_name\` TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
{
echo "GLPI Database Credentials"
echo "Database: $DB_NAME"
echo "Username: $DB_USER"
echo "Password: $DB_PASS"
} >> ~/glpi_db.creds
msg_ok "Set up database"
msg_info "Installing GLPi"
@ -48,14 +43,15 @@ RELEASE=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest
echo "${RELEASE}" >"/opt/${APP}_version.txt"
wget -q "https://github.com/glpi-project/glpi/releases/download/${RELEASE}/glpi-${RELEASE}.tgz"
tar -xzvf glpi-${RELEASE}.tgz
mv glpi /var/www/html/
cd /opt/glpi
cd /var/www/html/glpi
php bin/console db:install --db-name=$DB_NAME --db-user=$DB_USER --db-password=$DB_PASS --no-interaction
rm -rf /opt/glpi/install
rm -rf /var/www/html/glpi/install
msg_ok "Installed GLPi"
msg_info "Setting Downstream file"
cat <<EOF > /opt/glpi/inc/downstream.php
cat <<EOF > /var/www/html/glpi/inc/downstream.php
<?php
define('GLPI_CONFIG_DIR', '/etc/glpi/');
if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
@ -63,8 +59,8 @@ if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
}
EOF
mv /opt/glpi/config /etc/glpi
mv /opt/glpi/files /var/lib/glpi
mv /var/www/html/glpi/config /etc/glpi
mv /var/www/html/glpi/files /var/lib/glpi
mv /var/lib/glpi/_log /var/log/glpi
cat <<EOF > /etc/glpi/local_define.php
@ -87,13 +83,13 @@ EOF
msg_ok "Configured Downstream file"
msg_info "Setting Folder and File Permissions"
chown root:root /opt/glpi/ -R
chown root:root /var/www/html/glpi/ -R
chown www-data:www-data /etc/glpi -R
chown www-data:www-data /var/lib/glpi -R
chown www-data:www-data /var/log/glpi -R
chown www-data:www-data /opt/glpi/marketplace -Rf
find /opt/glpi/ -type f -exec chmod 0644 {} \;
find /opt/glpi/ -type d -exec chmod 0755 {} \;
chown www-data:www-data /var/www/html/glpi/marketplace -Rf
find /var/www/html/glpi/ -type f -exec chmod 0644 {} \;
find /var/www/html/glpi/ -type d -exec chmod 0755 {} \;
find /etc/glpi -type f -exec chmod 0644 {} \;
find /etc/glpi -type d -exec chmod 0755 {} \;
find /var/lib/glpi -type f -exec chmod 0644 {} \;
@ -106,9 +102,9 @@ msg_info "Setting VirtualHost"
cat <<EOF >/etc/apache2/sites-available/glpi.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /opt/glpi/public
DocumentRoot /var/www/html/glpi/public
<Directory /opt/glpi/public>
<Directory /var/www/html/glpi/public>
Require all granted
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)$
@ -125,10 +121,11 @@ EOF
a2dissite 000-default.conf
a2enmod rewrite
a2ensite glpi.conf
systemctl restart apache2
msg_ok "Configured VirtualHost"
msg_info "Setting Cron task"
echo "*/2 * * * * www-data /usr/bin/php /opt/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpi
echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpi
msg_ok "Configured Cron task"
msg_info "Changing parameters in php.ini"