Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 35 lines (26 sloc) 1.13 KB
# This script modifies all HTML files that are part of the nl-menu site
# to make it work when hosted on a new location. The script:
# 1. Sets the permissions of the whole tree to 644
# 2. Fixes relative links
# 3. Fixes Javascript redirects
# Location on file system
# Base directory on web server
# Old and new root domain (used for updating redirects)
while IFS= read -d $'\0' -r file ; do
# Rewrite relative links
sed -i "s|/|$baseDir/|g" $file
sed -i "s|/nlmenu.en|$baseDir/nlmenu.en|g" $file
# Update references to original nl-menu domain (fixes JavaScript redirects to old domain)
sed -i "s|$rootDomainOld|$rootDomainNew|g" $file
done < <(find $rootDir -type f -regex '.*\.\(html\|shtml\)' -print0)
# Copy index.html from dir to root dir
cp $rootDir/ $rootDir/index.html
# Set permissions on directories to 755; files to 644
find $rootDir -type d -exec chmod 755 {} \;
find $rootDir -type f -exec chmod 644 {} \;