#!/bin/bash

git submodule update --init --recursive

if [ -d author/project ]; then
	mv author/project author/pechatalka
fi

if [ -d author ]; then
	mv author mirzaev
fi

for i in svoboda/pechatalka/system/settings/*.sample; do
  echo $i;
  if [ ! -f "${i/.sample/}" ]; then
    cp -n "$i" "${i/.sample/}";
    echo ${i/.sample/};
  fi
done

if ! [ -d svoboda/pechatalka/system/public/js/modules ]; then
	mkdir svoboda/pechatalka/system/public/js/modules -p
fi

if ! [ -L svoboda/pechatalka/system/public/js/modules/damper.mjs ]; then
	ln -s ../../../../../../damper.mjs/damper.mjs svoboda/pechatalka/system/public/js/modules/damper.mjs;
fi

if ! [ -L svoboda/pechatalka/system/public/js/modules/pechatalka.mjs ]; then
	ln -s ../../../../../../pechatalka.mjs/pechatalka.mjs svoboda/pechatalka/system/public/js/modules/pechatalka.mjs;
fi
