PortValhalla/scripts/lib/profile-base.fish

27 lines
597 B
Fish
Executable file

#!/bin/env fish
begin
function processContent -a content
echo "$content"
end
function addProfileStatement -a name title shellBin extension profileRoot content
set -l file (mktemp)
if [ -z "$title" ]
set title "$name"
end
if [ -z "$content" ]
read -z content
end
begin
printf %s\n \
"#!$shellBin" \
"# $title" \
(processContent "$content")
end >"$file"
sudo install -Dm755 "$file" "$profileRoot/$name.$extension"
end
end