Compare commits

...

4 Commits

3 changed files with 47 additions and 13 deletions

View File

@ -1,11 +1,15 @@
export _url=hugo-skeleton.home export _url=hugo-skeleton.home
export _user=ray export _user=ray
export _git_user_name='rayelliott'
export _git_user_email='gitea@rayelliott.dev'
export _node_version=v12.16.1 export _node_version=v12.16.1
export _node_distro=linux-x64 export _node_distro=linux-x64
export _hugo_version=0.67.1 export _hugo_version=0.67.1
export _hugo_distro=Linux-64 export _hugo_distro=Linux-64
export _hugo_theme_git_url=https://github.com/dirkolbrich/hugo-theme-tailwindcss-starter export _hugo_theme_git_url=https://github.com/dirkolbrich/hugo-theme-tailwindcss-starter
# Note: this can be anything - does not need to match theme name above
export _hugo_theme_name=hugo-theme-tailwindcss-starter export _hugo_theme_name=hugo-theme-tailwindcss-starter
export _hugo_site_name=hugo-site-tailwindcss-starter export _hugo_site_name=hugo-site-tailwindcss-starter

View File

@ -26,18 +26,10 @@ 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 $_cmd_su "echo 'node_modules/' >> $_site_path/.gitignore"
fi $_cmd_su "cd $_site_path && git add . && git commit -m 'initial commit'"
$_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 +46,36 @@ 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
$_cmd_su "echo 'node_modules/' >> $_theme_path/.gitignore"
$_cmd_su "cd $_theme_path && git add . && git commit -m 'initial commit'"
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"

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
_cmd_su="su --login $_user -c"
useradd -m -s /bin/bash "$_user" useradd -m -s /bin/bash "$_user"
groupadd sudo groupadd sudo
usermod -aG sudo "$_user" usermod -aG sudo "$_user"
@ -10,10 +12,13 @@ passwd -d "$_user"
chage -d 0 "$_user" chage -d 0 "$_user"
if command -v apt-get ; then if command -v apt-get ; then
apt-get update && apt-get -y upgrade && apt-get -y install sudo apt-get update && apt-get -y upgrade && apt-get -y install sudo git
else else
echo "Error - no package installer found." echo "Error - no package installer found."
exit 1 exit 1
fi fi
$_cmd_su "git config --global user.email '$_git_user_email'"
$_cmd_su "git config --global user.name '$_git_user_name'"
# TODO ensure group sudo is allowed sudo # TODO ensure group sudo is allowed sudo