thalassa/examples/Smoky/mk.sh

105 lines
2.2 KiB
Bash
Raw Normal View History

2026-03-19 01:23:52 +00:00
#!/bin/sh
[ "$1" = "" ] && {
echo "Usage: $0 <lang>"
echo " where <lang> is either \"en\", or \"ru_koi\", or \"ru_utf\""
exit 1;
}
[ "$1" = "en" -o "$1" = "ru_koi" -o "$1" = "ru_utf" ] || {
echo "Only \"en\", \"ru_koi\" and \"ru_utf\" are supported"
exit 1;
}
LNG="$1"
TARGET="../_smoky_$LNG"
COMMON=../Common
[ -f base/smoky.ini ] || {
echo "Please run me in the Smoky template's directory"
exit 1
}
[ -d "$TARGET" ] && {
echo "Directory $TARGET already exists, please remove or rename it"
exit 1
}
# now the actual work begins
# build the directory tree
mkdir -p "$TARGET"
mkdir -p "${TARGET}/base"
mkdir -p "${TARGET}/db"
# populate the base/ subdir
for F in css.ini css_base.css colors.ini ; do
cp -a base/$F ${TARGET}/base/
done
cat ${COMMON}/base.ini base/smoky.ini > ${TARGET}/base/base.ini
cat ${COMMON}/cgi_base.ini base/cgi_smoky.ini > ${TARGET}/base/cgi_base.ini
cp -a base/srvfiles ${TARGET}/base
for F in cgiconf.ini ; do
cp -a ${COMMON}/$F ${TARGET}/base/
done
for F in cgi_msg.ini ; do
cp -a ${COMMON}/$LNG/$F ${TARGET}/base/
done
# populate the root dir with adjustable files
for F in thalassa.ini logo.png favicon.png ; do
cp -a $F ${TARGET}/
done
cp -a smoky_readme.txt ${TARGET}/README
for F in guestbook.ini htaccess.ini local.css cgilocal.ini ; do
cp -a ${COMMON}/$F ${TARGET}/
done
for F in srvtexts.ini mainmenu.ini cgitexts.ini feedback.ini ; do
cp -a ${COMMON}/$LNG/$F ${TARGET}/
done
cat ${COMMON}/config.ini ${COMMON}/${LNG}/config_lang.ini config_smoky.ini \
> ${TARGET}/config.ini
# copy the sample pages
cp -a ${COMMON}/db_pages ${TARGET}/db/pages
# produce the warning
cat > ${TARGET}/WARNING <<eOF
=== W A R N I N G ===
All contents of this directory is either copied from elsewhere, or
generated. See the Common/ and Smoky/ dirs for details.
All files in the subdirectories, as well as the thalassa.ini file,
are supposed to be a part of the Smoky template implementation, so
perhaps you shouldn't edit them. If you want to modify the template,
do so within the Common/ and Smoky/ directories.
Files that lay in the same directory with this WARNING file are intended
to be edited in order to custimize your site. Refer to the README file
for instructions.
eOF