tildeblack-ops/gopherroot.sh

14 lines
392 B
Bash
Executable File

#!/bin/sh
all_users=$(grep /home < /etc/passwd | awk -F: '{print $1}')
output="/var/gopher/users.gophermap"
printf "iUsers:\\n" > "$output"
printf "%s" "$all_users" | while read -r n; do
if [ -f "/var/gopher/users/${n}/gophermap" ]; then
printf "1~%s\\t/users/%s\\n" "$n" "$n" >> "$output"
fi
done
cat /var/gopher/head.gophermap /var/gopher/users.gophermap > /var/gopher/gophermap