-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rsync-nfsroot
and unfsd
commands
#6
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# vim: set noexpandtab tabstop=8 shiftwidth=4: | ||
|
||
set -e | ||
|
||
die() { | ||
|
@@ -124,6 +126,22 @@ run_subcommand() { | |
mkdir -p "$HOME/tftproot" | ||
cd "$HOME/tftproot" | ||
exec "$@";; | ||
"rsync-nfsroot "*" --server "*" . .") | ||
shift 1 | ||
mkdir -p "$HOME/nfsroot" | ||
cd "$HOME/nfsroot" | ||
exec rsync "$@";; | ||
"unfsd" *) | ||
rootdir="$2" | ||
shift 2 | ||
|
||
[ -n "$board_ip" ] || die 'Missing configuration option $board_ip' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it required to be an IP address or hostnames could be supported as well? If possible, I'd prefer that both IP addresses and hostnames can be specified here. Most programs can handle both. And to be consistent with the rest of the file, I'd prefer checking variables with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unfs3 manual says hostnames are supported as well so it should work. |
||
echo "$HOME/nfsroot/$rootdir $board_ip(rw,no_root_squash)" > "$HOME/export" | ||
|
||
# start or restart unfs3 to reread updated `exports` file | ||
[ -n "$nfs_port" ] || die 'Missing configuration option $nfs_port' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ${nfs_port:?} |
||
systemctl --user restart "unfsd@$nfs_port.service" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The I think that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm using it for the port variable, what would another option would be to replace the command with a script which sources the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use |
||
;; | ||
"on") | ||
power on | ||
exit;; | ||
|
@@ -175,7 +193,7 @@ main() { | |
# to the console. "The same user" means that we were executed by | ||
# the same sshd process that has the lock. This is ensured by | ||
# using SSH connection sharing on client side. | ||
reset | rsync | on | off) | ||
reset | rsync | rsync-nfsroot | unfsd | on | off) | ||
ALLOWED_PPID=$(cat $RUN_DIR/ppid 2>/dev/null || :) | ||
if [ "$PPID" -eq "${ALLOWED_PPID:-0}" ]; then run=unlocked; else run=locked; fi | ||
$run $0 "$@";; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=UNFS3 daemon (port %i) | ||
|
||
[Service] | ||
# -e /abs/path/to/exports | ||
# -n nfs_service_port | ||
# -m mount_service_port | ||
# -t # tcp only | ||
# -p # do not use portmapper | ||
# -s # single-user mode (map file ownership) | ||
ExecStart=unfsd -e %h/export -n %i -m %i -t -p -s | ||
|
||
[Install] | ||
WantedBy=default.target | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means that the service will be automatically started, when somebody logs in. This is not necessary. We want the service to be started only when somebody runs unfsd subcommand of novaboot-shell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want
$HOME/nfsroot/$NB_USER
here.