Commit fdaf04c1 authored by Brli's avatar Brli

add more verbosity to script

parent 0e0567a8
......@@ -84,9 +84,11 @@ actual_chroot() {
if [[ -S $socket && -S $extra_socket ]]; then
msg "Found $extra_socket"
[[ $VERBOSE == 1 ]] && warning "Socket file is $extra_socket"
  • I'm pretty sure this is completely broken when VERBOSE is not set. Because it will expand to [[ == 1]] which is not valid bash.

  • it isn't perfect yet, am just prototyping this :)

    however, bash would ignore that invalid [[ NULL == 1]] thing and passthrough

  • I would also prefer to have a single if [[ "x$VERBOSE" == "x1" ]] block close to the actual nspawn which prints the contents of ${binds[@]}, etc.

  • It's not going to be NULL though, AFAIR that is not a concept in bash. It's just going to be empty and not be valid bash.

    It might work somewhat in this case because the [[ ]] are on their own command. But it will break if you want to turn it into a if [[ $VERBOSE == 1 ]];then....

Please register or sign in to reply
local -n socket_to_bind=extra_socket
elif [[ -S $socket ]]; then
msg "Could not find $extra_socket, using $socket"
[[ $VERBOSE == 1 ]] && warning "Socket file is $socket"
local -n socket_to_bind=socket
else
msg "Can't find any main socket"
......@@ -97,6 +99,7 @@ actual_chroot() {
# Ideally we'd get that value from the chroots gpgconf but I don't
# want to actually run systemd-nspawn right here
[[ $VERBOSE == 1 ]] && warning "--bind-ro=$socket_to_bind:/$gnupg_chroot/S.gpg-agent"
binds+=(--bind-ro="$socket_to_bind":"/$gnupg_chroot/S.gpg-agent")
fi
else
......@@ -107,6 +110,7 @@ actual_chroot() {
local ssh=~/.ssh
if [[ -d $ssh ]]; then
msg "Found $ssh, will bind it to container!"
[[ $VERBOSE == 1 ]] && warning "--bind=$ssh:/chakra/.ssh"
binds+=(--bind="$ssh":/chakra/.ssh)
if [[ -S "$SSH_AUTH_SOCK" ]]; then
binds+=(--bind="$SSH_AUTH_SOCK")
......@@ -119,7 +123,7 @@ actual_chroot() {
# create an unique ID based on the current path $PWD
uniqueid=`echo -n $PWD | md5sum | awk '{print substr($1,0,6)}'`
[[ $VERBOSE == 1 ]] && warning "sudo systemd-nspawn -q --user=$_user -jD $PWD/${_chroot} -M $_user-$chroot_name-$uniqueid ${binds[@]} ${setenvs[@]}"
  • This should be sufficient. It prints all of the binds too. The warnings above seem somewhat redundant.

Please register or sign in to reply
sudo systemd-nspawn -q --user=$_user -jD $PWD/${_chroot} -M "$_user-$chroot_name-$uniqueid" "${binds[@]}" "${setenvs[@]}"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment