working gemini creation & operation

This commit is contained in:
Tilde Black Admin 2019-08-23 21:40:55 +00:00
parent f23ebaf336
commit 128ca4b161
4 changed files with 14 additions and 3 deletions

9
creategemini.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
all_users=$(grep /home < /etc/passwd | awk -F: '{print $1}')
printf "%s" "$all_users" | while read -r n; do
target="/var/gemini/users/${n}"
mkdir -p "$target"
chown "$n" "$target"
ln -s "$target" "/home/${n}/public_gemini"
done

View File

@ -6,10 +6,10 @@ template_dir="${current_dir}/templates/gemini"
output="${template_dir}/users.gemini"
printf "[Users]\\n" > "$output"
printf "%s" "$all_users" | while read -r n; do
target="/var/gemini/users/${n}"
if find "$target" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then
if [ -f "/var/gemini/users/${n}/.gemini" ]; then
printf "=> /users/%s ~%s\\n" "$n" "$n" >> "$output"
fi
done
cat "${template_dir}/head.gemini" "${output}" > /var/gemini/.gemini
cat "$output" > /var/gemini/users/.gemini

View File

@ -31,4 +31,4 @@ Tilde.Black is proud to support the emerging Gemini protocol.
=> gemini://zaibatsu.circumlunar.space Read more about Gemini
User pages will be coming soon.

View File

@ -0,0 +1,2 @@
[Users]
=> /users/fox ~fox