#!/bin/bash # We may need to update some configuration if we have upgraded from smeserver-backuppc.fws if [ -e /etc/BackupPC/config.pl ]; then # The new URL for backuppc images is /BackupPC/images sed -i 's|^\$Conf{CgiImageDirURL} .*|$Conf{CgiImageDirURL} = "/BackupPC/images";|' /etc/BackupPC/config.pl # Update paths sed -i 's|/opt/backuppc/files|/var/lib/BackupPC|' /etc/BackupPC/config.pl sed -i 's|/usr/local/BackupPC|/usr/share/BackupPC|' /etc/BackupPC/config.pl sed -i 's|/opt/backuppc/cgi-bin|/usr/share/BackupPC/sbin|' /etc/BackupPC/config.pl sed -i 's|/opt/backuppc/images|/usr/share/BackupPC/html|' /etc/BackupPC/config.pl # Update the admin user and the user whi receives the alerts sed -i "s|$Conf{CgiAdminUsers} = '';|$Conf{CgiAdminUsers} = 'admin';|" /etc/BackupPC/config.pl sed -i "s|$Conf{EMailAdminUserName} = 'backuppc';|$Conf{EMailAdminUserName} = 'admin';|" /etc/BackupPC/config.pl # Update the CgiURL SystemName=$(/sbin/e-smith/db configuration get SystemName) DomainName=$(/sbin/e-smith/db configuration get DomainName) sed -i "s|$Conf{CgiURL} = 'http://localhost/.*|$Conf{CgiURL} = 'https://$SystemName.$DomainName/BackupPC';|" /etc/BackupPC/config.pl # If par2 is not present, then put /bin/true in the config file to prevent an error if [ ! -x /usr/local/bin/par2 ]; then sed -i 's|^$Conf{ParPath} .*|$Conf{ParPath} = "/bin/true";|' /etc/BackupPC/config.pl fi fi # Same for localhost.pl, the default config in previous release if [ -e /etc/BackupPC/pc/localhost.pl ]; then sed -i "s|$Conf{DumpPreUserCmd} = '/usr/bin/sudo /usr/local/BackupPC/bin/BackupPC_SME_pre-backup';|$Conf{DumpPreUserCmd} = '/usr/bin/sudo /usr/share/BackupPC/bin/BackupPC_SME_pre-backup';|" /etc/BackupPC/pc/localhost.pl fi # Add the example configs EX=$(/sbin/e-smith/db configuration getprop backuppc examples) if [ $EX == 'enabled' ]; then if [ $(grep -c windows-template /etc/BackupPC/hosts) -lt 1 ]; then echo "windows-template 0 admin" >> /etc/BackupPC/hosts fi if [ $(grep -c localserver-template /etc/BackupPC/hosts) -lt 1 ]; then echo "localserver-template 0 admin" >> /etc/BackupPC/hosts fi if [ $(grep -c smeserver-template /etc/BackupPC/hosts) -lt 1 ]; then echo "smeserver-template 0 admin" >> /etc/BackupPC/hosts fi fi # Ensure permissions are ok chown -R backuppc:backuppc /etc/BackupPC/ chown -R backuppc:backuppc /var/log/BackupPC/ find /etc/BackupPC/ -type f -exec chmod 640 {} \;