cosmic/efingerd/luser

54 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# $1 = identity of remote user fingering you
# $2 = address of remote machine fingering you
# $3 = name of user being fingered (you!)
# shellcheck source=log
# shellcheck disable=SC1091
. /etc/efingerd/log
if [ "$3" = "root" ]; then
printf "QEC STATUS: ERROR\\nROOT ACCESS DENIED.\\n"
else
user_folder="/home/${3}"
# Prints current user's ship roster
printf "Ships registered to user \"%s\"\\n" "$3"
/usr/local/bin/roster "$3" | awk '{$1=" "; print $0}'
# This portion is maintained for compatability with fellowsh
# a tildeverse/pubnix social network built on fingerd
# Project
printf "Project:\\n"
if [ -f "${user_folder}/.project" ]; then
sed 's/^/ /' "${user_folder}/.project"
else
printf "No Project.\\n"
fi
# Plan
printf "Plan:\\n"
if [ -f "${user_folder}/.plan" ]; then
sed 's/^/ /' "${user_folder}/.plan"
else
printf "No Plan.\\n"
fi
# Timezone
if [ -f "${user_folder}/.tz" ]; then
printf "Timezone: %s\\n" "$(cat "${user_folder}/.tz")"
fi
# Timezone
if [ -f "${user_folder}/.pronouns" ]; then
printf "Pronouns: %s\\n" "$(cat "${user_folder}/.pronouns")"
fi
# Online status
if finger "$3" | grep -q 'On since'; then
printf "Online.\\n"
fi
fi