mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 16:59:17 +00:00
Compare commits
6 Commits
bf89286383
...
ee6442e39d
Author | SHA1 | Date | |
---|---|---|---|
|
ee6442e39d | ||
|
111a825f28 | ||
|
81780aa12c | ||
|
0bd4aeae7b | ||
|
de995d898f | ||
|
2899ade99f |
14
ct/glpi.sh
14
ct/glpi.sh
@ -1,10 +1,9 @@
|
||||
#!/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: kristocopani
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://semaphoreui.com/
|
||||
# Author: Nícolas Pastorello (opastorello)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
# App Default Values
|
||||
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/')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
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"
|
||||
#Auto update under development
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||
fi
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#Copyright (c) 2021-2025 community-scripts ORG
|
||||
# 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
|
||||
@ -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 "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"
|
||||
@ -43,15 +48,14 @@ 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 /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
|
||||
rm -rf /var/www/html/glpi/install
|
||||
rm -rf /opt/glpi/install
|
||||
msg_ok "Installed GLPi"
|
||||
|
||||
msg_info "Setting Downstream file"
|
||||
cat <<EOF > /var/www/html/glpi/inc/downstream.php
|
||||
cat <<EOF > /opt/glpi/inc/downstream.php
|
||||
<?php
|
||||
define('GLPI_CONFIG_DIR', '/etc/glpi/');
|
||||
if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
|
||||
@ -59,8 +63,8 @@ if (file_exists(GLPI_CONFIG_DIR . '/local_define.php')) {
|
||||
}
|
||||
EOF
|
||||
|
||||
mv /var/www/html/glpi/config /etc/glpi
|
||||
mv /var/www/html/glpi/files /var/lib/glpi
|
||||
mv /opt/glpi/config /etc/glpi
|
||||
mv /opt/glpi/files /var/lib/glpi
|
||||
mv /var/lib/glpi/_log /var/log/glpi
|
||||
|
||||
cat <<EOF > /etc/glpi/local_define.php
|
||||
@ -83,13 +87,13 @@ EOF
|
||||
msg_ok "Configured Downstream file"
|
||||
|
||||
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 /var/lib/glpi -R
|
||||
chown www-data:www-data /var/log/glpi -R
|
||||
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 {} \;
|
||||
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 {} \;
|
||||
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 {} \;
|
||||
@ -102,9 +106,9 @@ msg_info "Setting VirtualHost"
|
||||
cat <<EOF >/etc/apache2/sites-available/glpi.conf
|
||||
<VirtualHost *:80>
|
||||
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
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTP:Authorization} ^(.+)$
|
||||
@ -121,11 +125,10 @@ 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 /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_info "Changing parameters in php.ini"
|
||||
|
Loading…
Reference in New Issue
Block a user