initialise git repository in site directory
This commit is contained in:
parent
ce08c3d4d8
commit
581d9b4a9c
|
@ -26,18 +26,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$_cmd_su "cd ~ && hugo new site $_hugo_site_name"
|
$_cmd_su "cd ~ && hugo new site $_hugo_site_name"
|
||||||
|
$_cmd_su "cd $_site_path && git init"
|
||||||
if [ -z "$_hugo_theme_git_url" ] ; then
|
$_cmd_su "echo '/themes/' > $_site_path/.gitignore"
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
$_cmd_su "git clone $_hugo_theme_git_url $_theme_path"
|
|
||||||
|
|
||||||
$_cmd_su " rm -Rf $_theme_path/.git"
|
|
||||||
$_cmd_su "cd $_theme_path && git init"
|
|
||||||
|
|
||||||
$_cmd_su "cd $_theme_path && yarn install"
|
|
||||||
echo "theme = \"$_hugo_theme_name\"" >> $_site_path/config.toml
|
|
||||||
|
|
||||||
echo "#!/bin/sh" > "$_serve_script_path"
|
echo "#!/bin/sh" > "$_serve_script_path"
|
||||||
echo 'echo "sudo required to bind to port 80"' >> "$_serve_script_path"
|
echo 'echo "sudo required to bind to port 80"' >> "$_serve_script_path"
|
||||||
|
@ -54,3 +44,33 @@ hugo -v
|
||||||
EOF
|
EOF
|
||||||
chown "$_user": "$_build_script_path"
|
chown "$_user": "$_build_script_path"
|
||||||
chmod +x "$_build_script_path"
|
chmod +x "$_build_script_path"
|
||||||
|
|
||||||
|
if [ -n "$_hugo_theme_git_url" ] ; then
|
||||||
|
$_cmd_su "git clone $_hugo_theme_git_url $_theme_path"
|
||||||
|
|
||||||
|
$_cmd_su " rm -Rf $_theme_path/.git"
|
||||||
|
$_cmd_su "cd $_theme_path && git init"
|
||||||
|
|
||||||
|
$_cmd_su "cd $_theme_path && yarn install"
|
||||||
|
echo "theme = \"$_hugo_theme_name\"" >> $_site_path/config.toml
|
||||||
|
else
|
||||||
|
_theme_path='No theme installed'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "#################################################################################################"
|
||||||
|
echo ""
|
||||||
|
tee $_site_path/README.txt << EOF
|
||||||
|
Site directory: $_site_path
|
||||||
|
Theme directory: $_theme_path
|
||||||
|
|
||||||
|
BOTH directories have been initialised as git repositories.
|
||||||
|
|
||||||
|
Build script: $_build_script_path
|
||||||
|
Server script: $_serve_script_path
|
||||||
|
Server URL: http://$_url
|
||||||
|
EOF
|
||||||
|
echo ""
|
||||||
|
echo "#################################################################################################"
|
||||||
|
echo ""
|
||||||
|
chown "$_user": "$_site_path/README.txt"
|
||||||
|
|
Reference in New Issue