Refactor (#5844)
This commit is contained in:
parent
f01046133e
commit
1a53b749da
@ -29,17 +29,20 @@ function update_script() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
RELEASE=$(curl -fsSL https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
if [[ "${RELEASE}" != "$(cat ~/.firefly 2>/dev/null)" ]] || [[ ! -f ~/.firefly ]]; then
|
||||||
msg_info "Stopping Apache2"
|
msg_info "Stopping Apache2"
|
||||||
systemctl stop apache2
|
systemctl stop apache2
|
||||||
msg_ok "Stopped Apache2"
|
msg_ok "Stopped Apache2"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
msg_info "Backing up data"
|
||||||
cp /opt/firefly/.env /opt/.env
|
cp /opt/firefly/.env /opt/.env
|
||||||
cp -r /opt/firefly/storage /opt/storage
|
cp -r /opt/firefly/storage /opt/storage
|
||||||
cd /opt
|
msg_ok "Backed up data"
|
||||||
curl -fsSL "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz" -o $(basename "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz")
|
|
||||||
tar -xzf FireflyIII-v${RELEASE}.tar.gz -C /opt/firefly --exclude='storage'
|
fetch_and_deploy_gh_release "firefly" "firefly-iii/firefly-iii"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
|
rm -rf /opt/firefly/storage
|
||||||
cp /opt/.env /opt/firefly/.env
|
cp /opt/.env /opt/firefly/.env
|
||||||
cp -r /opt/storage /opt/firefly/storage
|
cp -r /opt/storage /opt/firefly/storage
|
||||||
cd /opt/firefly
|
cd /opt/firefly
|
||||||
@ -50,16 +53,12 @@ function update_script() {
|
|||||||
$STD php artisan view:clear
|
$STD php artisan view:clear
|
||||||
$STD php artisan firefly-iii:upgrade-database
|
$STD php artisan firefly-iii:upgrade-database
|
||||||
$STD php artisan firefly-iii:laravel-passport-keys
|
$STD php artisan firefly-iii:laravel-passport-keys
|
||||||
echo "${RELEASE}" >"/opt/${APP}_version.txt"
|
|
||||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||||
|
|
||||||
msg_info "Starting Apache2"
|
msg_info "Starting Apache2"
|
||||||
systemctl start apache2
|
systemctl start apache2
|
||||||
msg_ok "Started Apache2"
|
msg_ok "Started Apache2"
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
rm -rf /opt/FireflyIII-v${RELEASE}.tar.gz
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
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}."
|
||||||
|
@ -14,17 +14,14 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
|
$STD apt-get install -y apache2
|
||||||
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ bookworm main" >/etc/apt/sources.list.d/php.list
|
|
||||||
$STD apt-get update
|
|
||||||
$STD apt-get install -y \
|
|
||||||
apache2 \
|
|
||||||
libapache2-mod-php8.4 \
|
|
||||||
php8.4-{bcmath,cli,intl,curl,zip,gd,xml,mbstring,mysql} \
|
|
||||||
composer
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="mysql" setup_php
|
||||||
|
setup_composer
|
||||||
setup_mariadb
|
setup_mariadb
|
||||||
|
fetch_and_deploy_gh_release "firefly" "firefly-iii/firefly-iii"
|
||||||
|
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
msg_info "Setting up database"
|
msg_info "Setting up database"
|
||||||
DB_NAME=firefly
|
DB_NAME=firefly
|
||||||
@ -41,13 +38,7 @@ mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRI
|
|||||||
} >>~/firefly.creds
|
} >>~/firefly.creds
|
||||||
msg_ok "Set up database"
|
msg_ok "Set up database"
|
||||||
|
|
||||||
msg_info "Installing Firefly III (Patience)"
|
msg_info "Configuring Firefly III (Patience)"
|
||||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
|
||||||
cd /opt
|
|
||||||
curl -fsSL "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz" -o "FireflyIII-v${RELEASE}.tar.gz"
|
|
||||||
mkdir -p /opt/firefly
|
|
||||||
tar -xzf FireflyIII-v${RELEASE}.tar.gz -C /opt/firefly
|
|
||||||
chown -R www-data:www-data /opt/firefly
|
chown -R www-data:www-data /opt/firefly
|
||||||
chmod -R 775 /opt/firefly/storage
|
chmod -R 775 /opt/firefly/storage
|
||||||
cd /opt/firefly
|
cd /opt/firefly
|
||||||
@ -69,8 +60,7 @@ tar -xzf "DataImporter-v${IMPORTER_RELEASE}.tar.gz" -C /opt/firefly/dataimporter
|
|||||||
cp /opt/firefly/dataimporter/.env.example /opt/firefly/dataimporter/.env
|
cp /opt/firefly/dataimporter/.env.example /opt/firefly/dataimporter/.env
|
||||||
sed -i "s#FIREFLY_III_URL=#FIREFLY_III_URL=http://${LOCAL_IP}#g" /opt/firefly/dataimporter/.env
|
sed -i "s#FIREFLY_III_URL=#FIREFLY_III_URL=http://${LOCAL_IP}#g" /opt/firefly/dataimporter/.env
|
||||||
chown -R www-data:www-data /opt/firefly
|
chown -R www-data:www-data /opt/firefly
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
msg_ok "Configured Firefly III"
|
||||||
msg_ok "Installed Firefly III"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/apache2/sites-available/firefly.conf
|
cat <<EOF >/etc/apache2/sites-available/firefly.conf
|
||||||
@ -112,7 +102,6 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -rf "/opt/FireflyIII-v${RELEASE}.tar.gz"
|
|
||||||
rm -rf "/opt/DataImporter-v${IMPORTER_RELEASE}.tar.gz"
|
rm -rf "/opt/DataImporter-v${IMPORTER_RELEASE}.tar.gz"
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user