Update copyright notice

twv

Verified User
Joined
Oct 31, 2003
Messages
219
The copyright notice at the bottom of every DA page says

DirectAdmin Web Control Panel © 2007 JBMC Software

Could you please update that to 2010? It makes the panel look out of date as it is.
 
Copy and paste the following into /usr/local/bin/da_copyright.sh:

Code:
#!/bin/sh
#
# Update DirectAdmin's Copyright Notice
#

skin_dir=/usr/local/directadmin/data/skins
date=/bin/date
grep=/usr/bin/grep
sed=/usr/bin/sed
perl=/usr/bin/perl

# Verify all programs are available
[ ! -d $skin_dir ] && echo "Skin directory not found: $skin_dir" && exit
for p in $date $grep $sed $perl ; do
    [ ! -x $p ] && echo "Please install $date" && exit
done

# Go to the directory of skin files
cd $skin_dir

# What's the current year?
yyyy=`$date | $sed -e 's/^.*\([0-9]\{4\}\)$/\1/g'`

# Replace "nnnn JBMC Software" with "2003-yyyy JBMC Software"
files=`$grep -lre '[0-9]\{4\} JBMC Software' *`
$perl -pi'.orig' -e "s/(\d{4}-)?(\d{4})( JBMC Software)/2003-$yyyy\$3/" $files

Then setup proper permission and execute it:

% sudo chmod +x /usr/local/bin/da_copyright.sh
% sudo /usr/local/bin/da_copyright.sh

You should also add a crontab entry to run it on January 1 of every year. You may also need to re-run it after upgrading DirectAdmin, but that will be very rare.
 
Last edited:
Because the script doesn't enter into any sub directory within the /usr/local/directadmin/data/skins directory AFAICS?
 
I believe, it should be something like that:

Code:
#!/bin/sh
#
# Update DirectAdmin's Copyright Notice
#

skin_dir=/usr/local/directadmin/data/skins
date=/bin/date
grep=/bin/grep
sed=/bin/sed
perl=/usr/bin/perl

# Verify all programs are available
[ ! -d $skin_dir ] && echo "Skin directory not found: $skin_dir" && exit
for p in $date $grep $sed $perl ; do
    [ ! -x $p ] && echo "Please install $p" && exit
done

# Go to the directory of skin files
cd $skin_dir

# What's the current year?
yyyy=`$date | $sed -e 's/^.*\([0-9]\{4\}\)$/\1/g'`

# Replace "nnnn JBMC Software" with "2003-yyyy JBMC Software"
files=`$grep -lre '[0-9]\{4\} JBMC Software' *`
$perl -pi'.orig' -e "s/(\d{4}-)?(\d{4})( JBMC Software)/2003-$yyyy\$3/" $files

Otherwise I've got an error:

Please install $date

No need to restart directadmin.
 
Yes, thanks for catching the bug! :)

It goes without saying, if the script complains "Please install ...", then it won't work. Either edit the script to reflect the correct file path, or install the requested program. Those are fairly standard programs though: date, grep, sed, and perl.
 
Last edited:
Code:
>./da_copyright.sh
Please install /bin/date
>whereis date
date: /bin/date /usr/share/man/man1/date.1.gz


This is funny :D

Any suggestion?
 
Ok solved, isnt date the missing one but sed and grep had wrong path.

Filled the right path for the variable solved the problem.

Regards and thanks :)
 
Back
Top