| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-su | 3 # xdg-su |
| 4 # | 4 # |
| 5 # Utility script to run a command as an alternate user, generally | 5 # Utility script to run a command as an alternate user, generally |
| 6 # the root user, with a graphical prompt for the root | 6 # the root user, with a graphical prompt for the root |
| 7 # password if needed | 7 # password if needed |
| 8 # | 8 # |
| 9 # Refer to the usage() function below for usage. | 9 # Refer to the usage() function below for usage. |
| 10 # | 10 # |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 else | 74 else |
| 75 su_generic | 75 su_generic |
| 76 fi | 76 fi |
| 77 } | 77 } |
| 78 | 78 |
| 79 su_generic() | 79 su_generic() |
| 80 { | 80 { |
| 81 if [ -z "$user" ] ; then | 81 if [ -z "$user" ] ; then |
| 82 xterm -geom 60x5 -T "xdg-su: $cmd" -e su -c "$cmd" | 82 xterm -geom 60x5 -T "xdg-su: $cmd" -e su -c "$cmd" |
| 83 else | 83 else |
| 84 xterm -geom 60x5 -T "xdg-su: $cmd" -e su -u "$user" -c "$cmd" | 84 xterm -geom 60x5 -T "xdg-su: $cmd" -e su -c "$cmd" "$user" |
| 85 fi | 85 fi |
| 86 | 86 |
| 87 if [ $? -eq 0 ]; then | 87 if [ $? -eq 0 ]; then |
| 88 exit_success | 88 exit_success |
| 89 else | 89 else |
| 90 exit_failure_operation_failed | 90 exit_failure_operation_failed |
| 91 fi | 91 fi |
| 92 } | 92 } |
| 93 | 93 |
| 94 [ x"$1" != x"" ] || exit_failure_syntax | 94 [ x"$1" != x"" ] || exit_failure_syntax |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 generic) | 151 generic) |
| 152 su_generic | 152 su_generic |
| 153 ;; | 153 ;; |
| 154 | 154 |
| 155 *) | 155 *) |
| 156 [ x"$user" = x"" ] && user=root | 156 [ x"$user" = x"" ] && user=root |
| 157 exit_failure_operation_impossible "no graphical method available for invokin
g '$cmd' as '$user'" | 157 exit_failure_operation_impossible "no graphical method available for invokin
g '$cmd' as '$user'" |
| 158 ;; | 158 ;; |
| 159 esac | 159 esac |
| OLD | NEW |