63 lines
1.6 KiB
Bash
Executable file
63 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
FEDIZINE_DIR="$1"
|
|
FEDIZINE_DATA_DIR="$FEDIZINE_DIR/template_data"
|
|
CONTESTANT_AMOUNT="$2"
|
|
|
|
function dump_title
|
|
{
|
|
DIR=$1
|
|
|
|
if [ -f "$DIR/title.txt" ]; then
|
|
echo "Title exists"
|
|
return;
|
|
fi
|
|
echo "Dumping $DIR/title.txt"
|
|
touch "$DIR/title.txt"
|
|
echo "Fedizine Title (html only)" >> "$DIR/title.txt"
|
|
echo "Fedizine Header" >> "$DIR/title.txt"
|
|
echo "Fedizine Prompt" >> "$DIR/title.txt"
|
|
}
|
|
|
|
function dump_bio
|
|
{
|
|
BIO_PATH=$1
|
|
i=$2
|
|
|
|
|
|
|
|
BIO_FILE="$BIO_PATH/bio.txt"
|
|
if [ -f $BIO_FILE ]; then
|
|
echo "$BIO_FILE exists"
|
|
return;
|
|
fi
|
|
echo "Dumping $BIO_FILE"
|
|
touch "$BIO_FILE"
|
|
echo "Contestant $i" >> "$BIO_FILE"
|
|
echo "Contestant bio in single string" >> "$BIO_FILE"
|
|
}
|
|
|
|
function create_templates
|
|
{
|
|
TEMPLATE_PATH=$1
|
|
HTML_TEMPLATE_FILE="fedizine_html.sh"
|
|
MD_TEMPLATE_FILE="fedizine_md.sh"
|
|
|
|
echo "Creating templates"
|
|
./bash-tpl fedizine_monthly_template.html > "$TEMPLATE_PATH/$HTML_TEMPLATE_FILE" && chmod +x "$TEMPLATE_PATH/$HTML_TEMPLATE_FILE"
|
|
./bash-tpl fedizine_monthly_template.md > "$TEMPLATE_PATH/$MD_TEMPLATE_FILE" && chmod +x "$TEMPLATE_PATH/$MD_TEMPLATE_FILE"
|
|
}
|
|
|
|
|
|
echo "Creating $FEDIZINE_DATA_DIR"
|
|
mkdir $FEDIZINE_DATA_DIR -p
|
|
dump_title $FEDIZINE_DATA_DIR
|
|
|
|
for ((i=1;i<=$CONTESTANT_AMOUNT;++i)) do
|
|
mkdir "$FEDIZINE_DATA_DIR/contestants/contestant_$i/wholesome" -p
|
|
mkdir "$FEDIZINE_DATA_DIR/contestants/contestant_$i/lewd" -p
|
|
dump_bio "$FEDIZINE_DATA_DIR/contestants/contestant_$i" $i
|
|
done
|
|
|
|
create_templates $FEDIZINE_DIR
|
|
|