Fixed gui askpass, added linked folders in menu

This commit is contained in:
sose 2019-01-26 17:43:49 -08:00
parent 1634f32e98
commit 3d8d6b1aee
4 changed files with 19 additions and 8 deletions

View File

@ -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

View File

@ -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 "<item label=\"Configure Locations...\">\\n"
printf " <action name=\"Execute\">\\n"
@ -41,7 +41,13 @@ get_locations() {
printf " </action>\\n"
printf "</item>\\n"
fi
done < "$ssh_config_file"
done < "$mounts_file"
printf "<separator/>\\n"
printf "<item label=\"Configure More Locations...\">\\n"
printf " <action name=\"Execute\">\\n"
printf " <command>%s/.local/bin/sshfs_gui.sh</command>\\n" "$HOME"
printf " </action>\\n"
printf "</item>\\n"
fi
}

View File

@ -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!"

View File

@ -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}"