nixpkgs/pkgs/by-name/cj/cjdns-tools/wrapper.sh
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

30 lines
563 B
Bash

#!/usr/bin/env bash
export PATH="@@out@@/tools:$PATH"
set -eo pipefail
if ! cat /etc/cjdns.keys >/dev/null 2>&1; then
echo "ERROR: No permission to read /etc/cjdns.keys (use sudo)" >&2
exit 1
fi
if [[ -z $1 ]]; then
echo "Cjdns admin"
echo "Usage: $0 <command> <args..>"
echo
echo "Commands:" $(find @@out@@/tools -maxdepth 1 -type f | sed -r "s|.+/||g")
_sh=$(which sh)
PATH="@@out@@/tools" PS1="cjdns\$ " "$_sh"
else
if [[ ! -e @@out@@/tools/$1 ]]; then
echo "ERROR: '$1' is not a valid tool" >&2
exit 2
else
"$@"
fi
fi