|
#!/bin/bash
|
|
# vim: fileencoding=utf-8:nomodified:nowrap:textwidth=0:foldmethod=marker:foldcolumn=4:syntax=sh:filetype=sh:ruler:showcmd:lcs=tab\:|- list
|
|
|
|
MYDIR=`pwd`
|
|
BACK=""
|
|
FORTH=""
|
|
if [ -f "conf.py" -a -d "posts" ] ; then
|
|
echo "ERROR at root already"
|
|
exit
|
|
fi
|
|
while [ `pwd` != "/" ]; do
|
|
# echo -n "at" `pwd`
|
|
BD=`basename $PWD`
|
|
# echo " - $BD"
|
|
|
|
cd ..
|
|
if [ -f "conf.py" -a -d "posts" ] ; then
|
|
echo "ARRIVED"
|
|
break
|
|
fi
|
|
BACK="../$BACK"
|
|
FORTH="$BD/$FORTH"
|
|
done
|
|
if [ `pwd` == "/" ]; then
|
|
echo "ERROR not nikola subdir posts"
|
|
exit
|
|
fi
|
|
if [ "$BD" != "posts" ]; then
|
|
echo "ERROR not nikola subdir posts"
|
|
exit
|
|
fi
|
|
BACK=${BACK%/}
|
|
FORTH=${FORTH%/}
|
|
echo "BACK=$BACK; FORTH=$FORTH; MYDIR=$MYDIR; PWD=" `pwd`
|
|
#echo -n "ls \$FORTH="
|
|
#ls posts/$FORTH
|
|
cd $MYDIR
|
|
#echo -n "ls \$BACK="
|
|
#ls ../$BACK
|
|
|
|
if ! [ -d "${BACK}/../listings/blog/${FORTH}" ] ; then
|
|
echo "making listings"
|
|
mkdir -p "${BACK}/../listings/blog/${FORTH}"
|
|
else
|
|
echo "listings OK"
|
|
fi
|
|
#ls -l "${BACK}/../listings/blog/${FORTH}"
|
|
|
|
if ! [ -L listings ] ; then
|
|
echo "making listings link"
|
|
ln -s "${BACK}/../listings/blog/${FORTH}" "listings"
|
|
else
|
|
echo "listings link OK"
|
|
fi
|
|
#ls -l listings
|
|
|
|
if ! [ -d "${BACK}/../images/blog/${FORTH}" ] ; then
|
|
echo "making images"
|
|
mkdir -p "${BACK}/../images/blog/${FORTH}"
|
|
else
|
|
echo "images OK"
|
|
fi
|
|
#ls "${BACK}/../images/blog/${FORTH}"
|
|
|
|
if ! [ -L images ] ; then
|
|
echo "making images link"
|
|
ln -s "${BACK}/../images/blog/${FORTH}" "images"
|
|
else
|
|
echo "images link OK"
|
|
fi
|
|
#ls -l images
|
|
|
|
if ! [ -d "${BACK}/../files/blog/${FORTH}" ] ; then
|
|
echo "making files/blog/${FORTH}"
|
|
mkdir -p "${BACK}/../files/blog/${FORTH}"
|
|
else
|
|
echo "files/blog/${FORTH} OK"
|
|
fi
|
|
#ls "${BACK}/../files/blog/${FORTH}"
|
|
|
|
if ! [ -L "${BACK}/../files/blog/${FORTH}/listings" ] ; then
|
|
echo "making files/../listings link"
|
|
ln -s "${BACK}/../../output/listings/blog/${FORTH}" "${BACK}/../files/blog/${FORTH}/listings"
|
|
else
|
|
echo "files/../listings link OK"
|
|
fi
|
|
#ls -l ${BACK}/../files/blog/${FORTH}/listings
|
|
|
|
#ls "${BACK}/../files/blog/${FORTH}"
|
|
if ! [ -L "${BACK}/../files/blog/${FORTH}/images" ] ; then
|
|
echo "making files/../images link"
|
|
ln -s "${BACK}/../../output/images/blog/${FORTH}" "${BACK}/../files/blog/${FORTH}/images"
|
|
else
|
|
echo "files/../images link OK"
|
|
fi
|
|
#ls -l ${BACK}/../files/blog/${FORTH}/images
|