mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
ref: replace 'whoami' with 'id -u -n' for POSIX compatibility
This commit is contained in:
@@ -134,7 +134,7 @@ file)
|
|||||||
```sh
|
```sh
|
||||||
sudo env PATH="$PATH" \
|
sudo env PATH="$PATH" \
|
||||||
serviceman add --path="$PATH" --system \
|
serviceman add --path="$PATH" --system \
|
||||||
--username "$(whoami)" --name my-project -- \
|
--username "$(id -u -n)" --name my-project -- \
|
||||||
bun run ./my-project.js
|
bun run ./my-project.js
|
||||||
```
|
```
|
||||||
4. Restart the logging service
|
4. Restart the logging service
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ the file:
|
|||||||
```sh
|
```sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Who am I? I'm $(whoami)."
|
echo "Who am I? I'm $(id -u -n)."
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also run bash explicitly:
|
You can also run bash explicitly:
|
||||||
@@ -99,7 +99,7 @@ You should use `chsh` to change your shell:
|
|||||||
```sh
|
```sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
sudo chsh -s "$(command -v fish)" "$(whoami)"
|
sudo chsh -s "$(command -v fish)" "$(id -u -n)"
|
||||||
```
|
```
|
||||||
|
|
||||||
If vim uses `fish` instead of `bash`, annoying errors will happen.
|
If vim uses `fish` instead of `bash`, annoying errors will happen.
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ pushd ./hello/
|
|||||||
|
|
||||||
# swap 'hello' and './hello' for the name of your project and binary
|
# swap 'hello' and './hello' for the name of your project and binary
|
||||||
sudo env PATH="$PATH" \
|
sudo env PATH="$PATH" \
|
||||||
serviceman add --system --username "$(whoami)" --name hello -- \
|
serviceman add --system --username "$(id -u -n)" --name hello -- \
|
||||||
./hello
|
./hello
|
||||||
|
|
||||||
# Restart the logging service
|
# Restart the logging service
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ pushd ./hello/
|
|||||||
|
|
||||||
# swap 'hello' and './hello' for the name of your project and binary
|
# swap 'hello' and './hello' for the name of your project and binary
|
||||||
sudo env PATH="$PATH" \
|
sudo env PATH="$PATH" \
|
||||||
serviceman add --system --username "$(whoami)" --name hello -- \
|
serviceman add --system --username "$(id -u -n)" --name hello -- \
|
||||||
./hello
|
./hello
|
||||||
|
|
||||||
# Restart the logging service
|
# Restart the logging service
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ To enable Postgres as a Linux Service with [serviceman](../serviceman/): \
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo env PATH="$PATH" \
|
sudo env PATH="$PATH" \
|
||||||
serviceman add --system --username "$(whoami)" --name 'postgres' -- \
|
serviceman add --system --username "$(id -u -n)" --name 'postgres' -- \
|
||||||
postgres -D ~/.local/share/postgres/var -p 5432
|
postgres -D ~/.local/share/postgres/var -p 5432
|
||||||
|
|
||||||
sudo systemctl restart systemd-journald
|
sudo systemctl restart systemd-journald
|
||||||
@@ -120,7 +120,7 @@ curl https://webi.sh/serviceman | sh
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo env PATH="$PATH" \
|
sudo env PATH="$PATH" \
|
||||||
serviceman add --system --username "$(whoami)" --name 'postgres' -- \
|
serviceman add --system --username "$(id -u -n)" --name 'postgres' -- \
|
||||||
postgres -D ~/.local/share/postgres/var -p 5432
|
postgres -D ~/.local/share/postgres/var -p 5432
|
||||||
|
|
||||||
sudo systemctl restart systemd-journald
|
sudo systemctl restart systemd-journald
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ main() {
|
|||||||
my_key_url="${2:-}"
|
my_key_url="${2:-}"
|
||||||
my_keys=""
|
my_keys=""
|
||||||
|
|
||||||
if [ "root" != "$(whoami)" ]; then
|
if [ "root" != "$(id -u -n)" ]; then
|
||||||
echo "webi adduser: running user is already a non-root user"
|
echo "webi adduser: running user is already a non-root user"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ folder:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
rsync -av "$HOME/.ssh/id_rsa.pub" \
|
rsync -av "$HOME/.ssh/id_rsa.pub" \
|
||||||
"$HOME/Downloads/id_rsa.$(whoami).pub"
|
"$HOME/Downloads/id_rsa.$(id -u -n).pub"
|
||||||
```
|
```
|
||||||
|
|
||||||
How to print your public key to the Terminal:
|
How to print your public key to the Terminal:
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ main() {
|
|||||||
# TODO use the comment (if any) for the name of the file
|
# TODO use the comment (if any) for the name of the file
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
#shellcheck disable=SC2088
|
#shellcheck disable=SC2088
|
||||||
echo >&2 "~/Downloads/id_${my_keytype}.$(whoami).pub":
|
echo >&2 "~/Downloads/id_${my_keytype}.$(id -u -n).pub":
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
rm -f "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
rm -f "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub"
|
||||||
cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
cp -RPp "$HOME/.ssh/id_${my_keytype}.pub" "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub"
|
||||||
cat "$HOME/Downloads/id_${my_keytype}.$(whoami).pub"
|
cat "$HOME/Downloads/id_${my_keytype}.$(id -u -n).pub"
|
||||||
echo >&2 ""
|
echo >&2 ""
|
||||||
|
|
||||||
if test -f ~/.ssh/id_rsa; then
|
if test -f ~/.ssh/id_rsa; then
|
||||||
|
|||||||
Reference in New Issue
Block a user