Compare commits

...

6 Commits

Author SHA1 Message Date
Nícolas Pastorello
ee6442e39d
Update glpi-install.sh 2025-01-03 11:22:36 -03:00
Nícolas Pastorello
111a825f28
Update glpi-install.sh 2025-01-03 11:19:40 -03:00
Nícolas Pastorello
81780aa12c
Update glpi-install.sh 2025-01-03 09:30:47 -03:00
Nícolas Pastorello
0bd4aeae7b
Update install/glpi-install.sh
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-01-03 09:27:37 -03:00
Nícolas Pastorello
de995d898f
Update install/glpi-install.sh
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2025-01-03 09:27:24 -03:00
Nícolas Pastorello
2899ade99f
Update glpi.sh 2025-01-03 09:25:02 -03:00
2 changed files with 24 additions and 27 deletions

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: kristocopani # Author: Nícolas Pastorello (opastorello)
# License: MIT # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://semaphoreui.com/
# App Default Values # App Default Values
APP="GLPI" APP="GLPI"
@ -37,12 +36,7 @@ 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/') 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 if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}" msg_info "Updating ${APP} to v${RELEASE}"
cd /opt #Auto update under development
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 else
msg_ok "No update required. ${APP} is already at v${RELEASE}." msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi fi

View File

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