Add a script to copy files most commonly overridden on a new site.
This commit is contained in:
parent
f0ba6de8b9
commit
8a97a60da1
1 changed files with 36 additions and 0 deletions
36
scripts/set_up_new_site.sh
Executable file
36
scripts/set_up_new_site.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# shell script hardening
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# This script copies the scss and layout files I think most people
|
||||||
|
# would like to override. It also copies the example config file.
|
||||||
|
# (Run chmod 700 on this file to make it executable)
|
||||||
|
|
||||||
|
if [[ ! "$0" =~ "themes/zen/scripts/set_up_new_site.sh" ]]; then
|
||||||
|
echo "Error: This script must be run from the project root directory."
|
||||||
|
echo "Usage: ./theme/zen/set_up_new_site.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "assets/sass/init"
|
||||||
|
|
||||||
|
copy_files=("themes/zen/assets/sass/init/_colors.scss:assets/sass/init/_colors.scss"
|
||||||
|
"themes/zen/assets/sass/init/_variables.scss:assets/sass/init/_variables.scss"
|
||||||
|
"themes/zen/assets/sass/_custom.scss:assets/sass/_custom.scss"
|
||||||
|
"themes/zen/assets/sass/_zen.scss:assets/sass/_zen.scss"
|
||||||
|
"themes/zen/layouts/index.html:layouts/index.html"
|
||||||
|
"themes/zen/exampleSite/config.yaml:config.yaml")
|
||||||
|
|
||||||
|
for files in "${copy_files[@]}" ; do
|
||||||
|
if [[ ! -f "${files##*:}" ]]; then
|
||||||
|
cp "${files%%:*}" "${files##*:}"
|
||||||
|
echo "Copied: ${files##*:}"
|
||||||
|
else
|
||||||
|
echo "Already exist so not overwritten: ${files##*:}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -f "config.toml" && -f "config.yaml" ]]; then
|
||||||
|
mv config.toml config.toml.old
|
||||||
|
fi
|
||||||
Loading…
Reference in a new issue