Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions ct/barcode-buddy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@ function update_script() {
header_info
check_container_storage
check_container_resources

if [[ ! -d /opt/barcodebuddy ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/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 ~/.barcodebuddy 2>/dev/null)" ]] || [[ ! -f ~/.barcodebuddy ]]; then
msg_info "Stopping Service"
systemctl stop apache2
systemctl stop barcodebuddy
msg_ok "Stopped Service"

msg_info "Updating ${APP} to v${RELEASE}"
cd /opt
msg_info "Backing up data"
mv /opt/barcodebuddy/ /opt/barcodebuddy-backup
curl -fsSL "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip")
$STD unzip "v${RELEASE}.zip"
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
msg_ok "Backed up data"

fetch_and_deploy_gh_release "barcodebuddy" "Forceu/barcodebuddy"

msg_info "Configuring ${APP}"
cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data
chown -R www-data:www-data /opt/barcodebuddy/data
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated $APP to v${RELEASE}"
msg_ok "Configured ${APP}"

msg_info "Starting Service"
systemctl start apache2
systemctl start barcodebuddy
msg_ok "Started Service"

msg_info "Cleaning up"
rm -r "/opt/v${RELEASE}.zip"
rm -r /opt/barcodebuddy-backup
msg_ok "Cleaned"
msg_ok "Updated Successfully"
Expand Down
18 changes: 6 additions & 12 deletions install/barcode-buddy-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,15 @@ update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
apache2 \
redis \
php-{curl,date,json,mbstring,redis,sqlite3,sockets} \
libapache2-mod-php
redis
msg_ok "Installed Dependencies"

msg_info "Installing barcodebuddy"
RELEASE=$(curl -fsSL https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
cd /opt
curl -fsSL "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip"
$STD unzip "v${RELEASE}.zip"
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
PHP_VERSION="8.2" PHP_APACHE="YES" PHP_MODULE="date, json, redis, sqlite3, sockets" setup_php
fetch_and_deploy_gh_release "barcodebuddy" "Forceu/barcodebuddy"

msg_info "Configuring barcodebuddy"
chown -R www-data:www-data /opt/barcodebuddy/data
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed barcodebuddy"
msg_ok "Configured barcodebuddy"

msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/barcodebuddy.service
Expand Down Expand Up @@ -73,7 +68,6 @@ motd_ssh
customize

msg_info "Cleaning up"
rm -rf "/opt/v${RELEASE}.zip"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"