Skip to content

Commit 782e0a8

Browse files
authored
New script: Barcode Buddy (#2167)
1 parent 5863d81 commit 782e0a8

File tree

3 files changed

+196
-0
lines changed

3 files changed

+196
-0
lines changed

ct/barcode-buddy.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/Forceu/barcodebuddy
7+
8+
# App Default Values
9+
APP="Barcode-Buddy"
10+
var_tags="grocery;household"
11+
var_cpu="1"
12+
var_ram="512"
13+
var_disk="3"
14+
var_os="debian"
15+
var_version="12"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -d /opt/barcodebuddy ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
RELEASE=$(curl -s https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
36+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
37+
msg_info "Stopping Service"
38+
systemctl stop apache2
39+
systemctl stop barcodebuddy
40+
msg_ok "Stopped Service"
41+
42+
msg_info "Updating ${APP} to v${RELEASE}"
43+
cd /opt
44+
mv /opt/barcodebuddy/ /opt/barcodebuddy-backup
45+
wget -q "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip"
46+
unzip -q "v${RELEASE}.zip"
47+
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
48+
cp -r /opt/barcodebuddy-backup/data/. /opt/barcodebuddy/data
49+
chown -R www-data:www-data /opt/barcodebuddy/data
50+
echo "${RELEASE}" >/opt/${APP}_version.txt
51+
msg_ok "Updated $APP to v${RELEASE}"
52+
53+
msg_info "Starting Service"
54+
systemctl start apache2
55+
systemctl start barcodebuddy
56+
msg_ok "Started Service"
57+
58+
msg_info "Cleaning up"
59+
rm -r "/opt/v${RELEASE}.zip"
60+
rm -r /opt/barcodebuddy-backup
61+
msg_ok "Cleaned"
62+
msg_ok "Updated Successfully"
63+
else
64+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
65+
fi
66+
exit
67+
}
68+
69+
start
70+
build_container
71+
description
72+
73+
msg_ok "Completed Successfully!\n"
74+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
75+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
76+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"

install/barcode-buddy-install.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: bvdberg01
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
7+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
8+
color
9+
verb_ip6
10+
catch_errors
11+
setting_up_container
12+
network_check
13+
update_os
14+
15+
msg_info "Installing Dependencies"
16+
$STD apt-get install -y \
17+
curl \
18+
sudo \
19+
mc \
20+
apache2 \
21+
redis \
22+
php-{curl,date,json,mbstring,redis,sqlite3,sockets} \
23+
libapache2-mod-php
24+
msg_ok "Installed Dependencies"
25+
26+
msg_info "Installing barcodebuddy"
27+
RELEASE=$(curl -s https://api.github.com/repos/Forceu/barcodebuddy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
28+
cd /opt
29+
wget -q "https://github.com/Forceu/barcodebuddy/archive/refs/tags/v${RELEASE}.zip"
30+
unzip -q "v${RELEASE}.zip"
31+
mv "/opt/barcodebuddy-${RELEASE}" /opt/barcodebuddy
32+
chown -R www-data:www-data /opt/barcodebuddy/data
33+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
34+
msg_ok "Installed barcodebuddy"
35+
36+
msg_info "Creating Services"
37+
cat <<EOF >/etc/systemd/system/barcodebuddy.service
38+
[Unit]
39+
Description=Run websocket server for barcodebuddy screen feature
40+
After=network.target
41+
42+
[Service]
43+
Type=simple
44+
ExecStart=/usr/bin/php /opt/barcodebuddy/wsserver.php
45+
StandardOutput=null
46+
Restart=on-failure
47+
User=www-data
48+
49+
[Install]
50+
WantedBy=multi-user.target
51+
EOF
52+
cat <<EOF >/etc/apache2/sites-available/barcodebuddy.conf
53+
<VirtualHost *:80>
54+
ServerName barcodebuddy
55+
DocumentRoot /opt/barcodebuddy
56+
57+
<Directory /opt/barcodebuddy>
58+
Options FollowSymLinks
59+
AllowOverride All
60+
Require all granted
61+
</Directory>
62+
63+
ErrorLog /var/log/apache2/barcodebuddy_error.log
64+
CustomLog /var/log/apache2/barcodebuddy_access.log combined
65+
</VirtualHost>
66+
EOF
67+
systemctl enable -q --now barcodebuddy
68+
$STD a2ensite barcodebuddy
69+
$STD a2enmod rewrite
70+
$STD a2dissite 000-default.conf
71+
$STD systemctl reload apache2
72+
msg_ok "Created Services"
73+
74+
motd_ssh
75+
customize
76+
77+
msg_info "Cleaning up"
78+
rm -rf "/opt/v${RELEASE}.zip"
79+
$STD apt-get -y autoremove
80+
$STD apt-get -y autoclean
81+
msg_ok "Cleaned"

json/barcode-buddy.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Barcode buddy",
3+
"slug": "barcode-buddy",
4+
"categories": [
5+
24
6+
],
7+
"date_created": "2025-02-08",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://barcodebuddy-documentation.readthedocs.io/en/latest/",
13+
"website": "https://github.com/Forceu/barcodebuddy",
14+
"logo": null,
15+
"description": "Barcode Buddy for Grocy is an extension for Grocy, allowing to pass barcodes to Grocy. It supports barcodes for products and chores. If you own a physical barcode scanner, it can be integrated, so that all barcodes scanned are automatically pushed to BarcodeBuddy/Grocy.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/barcode-buddy.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 512,
23+
"hdd": 3,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": [
34+
{
35+
"text": "After install enable the option \"Use Redis cache\" on the settings page.",
36+
"type": "info"
37+
}
38+
]
39+
}

0 commit comments

Comments
 (0)