blob: e5700418d8de8ed131a9d0741d6c12ae9c159550 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
post_install() {
echo "==> Creating ferron user and group..."
systemd-sysusers
echo "==> Setting up directories and permissions..."
systemd-tmpfiles --create
chown -R ferron:ferron /var/log/ferron
chown -R ferron:ferron /var/www/ferron
find /var/log/ferron -type d -exec chmod 755 {} \;
find /var/log/ferron -type f -exec chmod 644 {} \;
find /var/www/ferron -type d -exec chmod 755 {} \;
find /var/www/ferron -type f -exec chmod 644 {} \;
echo "==> Ferron is now installed. Start it with: systemctl start ferron"
}
post_upgrade() {
echo "Updating permissions..."
chown -R ferron:ferron /var/log/ferron
chown -R ferron:ferron /var/www/ferron
find /var/log/ferron -type d -exec chmod 755 {} \;
find /var/log/ferron -type f -exec chmod 644 {} \;
find /var/www/ferron -type d -exec chmod 755 {} \;
find /var/www/ferron -type f -exec chmod 644 {} \;
if [ -f /etc/ferron.yaml ] && [ ! -f /etc/ferron.kdl ]; then
if command -v ferron-yaml2kdl >/dev/null 2>&1; then
echo "==> Detected legacy /etc/ferron.yaml"
echo "==> Converting to /etc/ferron.kdl..."
if ferron-yaml2kdl /etc/ferron.yaml > /etc/ferron.kdl; then
cp -a /etc/ferron.yaml /etc/ferron.yaml.bak
echo "==> Conversion successful."
echo "==> Backup saved as /etc/ferron.yaml.bak"
else
echo "==> WARNING: Conversion failed."
echo "==> Please convert manually using ferron-yaml2kdl."
fi
else
echo "==> WARNING: ferron-yaml2kdl not found."
echo "==> Cannot auto-convert ferron.yaml."
fi
fi
if systemctl is-active --quiet ferron; then
echo "==> Ferron is still running, please restart it ASAP to apply updates"
fi
}
post_remove() {
echo "==> Ferron configuration and data directories are preserved."
echo "==> Remove them manually if they are no longer needed:"
echo " /etc/ferron.kdl"
echo " /var/www/ferron"
echo " /var/log/ferron"
}
|