diff --git a/README.md b/README.md index d4367b7..fb4a7eb 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Part of TildeLinux. - Code cleanup - Move shared functions into separate files - Error handling for file creation +- Alert user if (local) directory they are trying to link to already contains a link - The exit and cancel buttons should do the same thing ### ChangeLog diff --git a/openbox_files.sh b/openbox_files.sh index 2f01be2..ffec546 100755 --- a/openbox_files.sh +++ b/openbox_files.sh @@ -17,10 +17,10 @@ # # Email: tildelinux@tildeverse.org -ssh_config_file="$HOME/.ssh/config" +mounts_file="$HOME/.ssh/mounts" get_locations() { - if ! grep -q "SSHFS Mount " "$ssh_config_file" + if ! grep -q "SSHFS Mount " "$mounts_file" then printf "\\n" printf " \\n" @@ -41,7 +41,13 @@ get_locations() { printf " \\n" printf "\\n" fi - done < "$ssh_config_file" + done < "$mounts_file" + printf "\\n" + printf "\\n" + printf " \\n" + printf " %s/.local/bin/sshfs_gui.sh\\n" "$HOME" + printf " \\n" + printf "\\n" fi } diff --git a/setup_gui.sh b/setup_gui.sh index f66f12e..830f656 100755 --- a/setup_gui.sh +++ b/setup_gui.sh @@ -17,8 +17,8 @@ # # Email: tildelinux@tildeverse.org +export SSH_ASKPASS="/usr/lib/ssh/x11-ssh-askpass" set -e - eval "$(xdotool getmouselocation --shell)" mouse_x=$X mouse_y=$Y @@ -189,7 +189,7 @@ configure_server() { info_pid=$(( $! + 2 )) # yikes, is this safe? printf "%s\\n" "$ssh_temp_config" printf "%s\\n" "$server_address" - if ssh -qF "$ssh_temp_config" "$server_name" exit + if setsid -w ssh -qF "$ssh_temp_config" "$server_name" exit then kill $info_pid succ_box "Login success!\\nAccount for ${server_address} created!" diff --git a/sshfs_gui.sh b/sshfs_gui.sh index e52eba4..7315136 100755 --- a/sshfs_gui.sh +++ b/sshfs_gui.sh @@ -17,12 +17,15 @@ # # Email: tildelinux@tildeverse.org +export SSH_ASKPASS="/usr/lib/ssh/x11-ssh-askpass" + setup_script_path="$HOME/.local/bin/setup_gui.sh" eval "$(xdotool getmouselocation --shell)" mouse_x=$X mouse_y=$Y +mounts_file="$HOME/.ssh/mounts" ssh_config_file="$HOME/.ssh/config" server_name=$(grep -E "[H,h]ost " "$ssh_config_file" \ | cut -f 2 -d ' ' \ @@ -152,24 +155,25 @@ configure_mount() { test -e "$sshfs_local_path" \ || mkdir -p "$sshfs_local_path" - if ! ssh "$server_name" "test -d \${sshfs_remote_path}" + if ! setsid -w ssh "$server_name" "test -d \${sshfs_remote_path}" then if dec_box "Directory $sshfs_remote_path does not exist on remote host, create?" then - if ! error_msg=$(ssh "$server_name" "mkdir \${sshfs_remote_path}" 2>&1) + if ! error_msg=$(setsid -w ssh "$server_name" "mkdir \${sshfs_remote_path}" 2>&1) then error_box "Failed to create remote directory. ${error_msg}" fi fi fi - if error_msg=$(sshfs \ + if error_msg=$(setsid -w sshfs \ "${server_name}:${sshfs_remote_path}" \ "$sshfs_local_path" \ -oauto_cache,reconnect,Compression=no 2>&1) then kill $info_pid succ_box "Successfuly linked ${sshfs_local_path} to ${sshfs_remote_path} on ${server_name}" + printf "SSHFS Mount %s (%s)\\n" "${sshfs_local_path}" "${server_name}" >> "$mounts_file" else kill $info_pid error_box "Failed to link ${sshfs_local_path} to ${sshfs_remote_path} on ${server_name}\\n${error_msg}"