From 1480c2bfa52b281c289d70395f14cc310dd0889f Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 25 Feb 2014 19:36:21 -0500 Subject: [PATCH 01/11] Ported pacman aliases from oh-my-zsh's archlinux plugin. Added support for having multiple sub-plugins within the archlinux family. --- plugins/archlinux/README.md | 22 +++++++++ plugins/archlinux/archlinux.load | 6 +++ plugins/archlinux/pacman/README.md | 52 ++++++++++++++++++++ plugins/archlinux/pacman/pacdisowned.fish | 18 +++++++ plugins/archlinux/pacman/pacin.fish | 3 ++ plugins/archlinux/pacman/pacins.fish | 3 ++ plugins/archlinux/pacman/paclist.fish | 3 ++ plugins/archlinux/pacman/pacloc.fish | 3 ++ plugins/archlinux/pacman/paclocs.fish | 3 ++ plugins/archlinux/pacman/paclsorphans.fish | 3 ++ plugins/archlinux/pacman/pacmanallkeys.fish | 7 +++ plugins/archlinux/pacman/pacmansignkeys.fish | 9 ++++ plugins/archlinux/pacman/pacmir.fish | 3 ++ plugins/archlinux/pacman/pacre.fish | 3 ++ plugins/archlinux/pacman/pacrem.fish | 3 ++ plugins/archlinux/pacman/pacrep.fish | 3 ++ plugins/archlinux/pacman/pacreps.fish | 3 ++ plugins/archlinux/pacman/pacrmorphans.fish | 3 ++ plugins/archlinux/pacman/pacupd.fish | 10 ++++ plugins/archlinux/pacman/pacupg.fish | 3 ++ 20 files changed, 163 insertions(+) create mode 100644 plugins/archlinux/README.md create mode 100644 plugins/archlinux/archlinux.load create mode 100644 plugins/archlinux/pacman/README.md create mode 100644 plugins/archlinux/pacman/pacdisowned.fish create mode 100644 plugins/archlinux/pacman/pacin.fish create mode 100644 plugins/archlinux/pacman/pacins.fish create mode 100644 plugins/archlinux/pacman/paclist.fish create mode 100644 plugins/archlinux/pacman/pacloc.fish create mode 100644 plugins/archlinux/pacman/paclocs.fish create mode 100644 plugins/archlinux/pacman/paclsorphans.fish create mode 100644 plugins/archlinux/pacman/pacmanallkeys.fish create mode 100644 plugins/archlinux/pacman/pacmansignkeys.fish create mode 100644 plugins/archlinux/pacman/pacmir.fish create mode 100644 plugins/archlinux/pacman/pacre.fish create mode 100644 plugins/archlinux/pacman/pacrem.fish create mode 100644 plugins/archlinux/pacman/pacrep.fish create mode 100644 plugins/archlinux/pacman/pacreps.fish create mode 100644 plugins/archlinux/pacman/pacrmorphans.fish create mode 100644 plugins/archlinux/pacman/pacupd.fish create mode 100644 plugins/archlinux/pacman/pacupg.fish diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md new file mode 100644 index 0000000..a5645f4 --- /dev/null +++ b/plugins/archlinux/README.md @@ -0,0 +1,22 @@ + +# The Arch Linux Plugins + +The Arch Linux Plugins provides a number of plugins to make using arch easier. + +# The Plugins + +## archlinux + +This plugin includes all of provided Arch Linux Plugins wrapped in a single plugin. + +To use this plugin append the following `archlinux` to `fish_plugins`. + +## archlinux/pacman + +This plugin makes working work pacman easier and faster. Please refer to pacman/README.md for more information. + +To use this plugin append the following `archlinux` to `fish_plugins`. + + + + diff --git a/plugins/archlinux/archlinux.load b/plugins/archlinux/archlinux.load new file mode 100644 index 0000000..54d711a --- /dev/null +++ b/plugins/archlinux/archlinux.load @@ -0,0 +1,6 @@ + + +set -l current_dir (dirname $argv) + +# add pacman related functions +set fish_function_path $current_dir/pacman $fish_function_path diff --git a/plugins/archlinux/pacman/README.md b/plugins/archlinux/pacman/README.md new file mode 100644 index 0000000..054d699 --- /dev/null +++ b/plugins/archlinux/pacman/README.md @@ -0,0 +1,52 @@ + +# pacman functions # + +* pacin +Install specific package(s) from the repositories + +* pacins +Install specific package not from the repositories but from a file + +* pacre +Remove the specified package(s), retaining its configuration(s) and required dependencies + +* pacrem +Remove the specified package(s), its configuration(s) and unneeded dependencies + +* pacrep +Display information about a given package in the repositories + +* pacreps +Search for package(s) in the repositories + +* pacloc +Display information about a given package in the local database + +* paclocs +Search for package(s) in the local database + +* pacupd +Update and refresh the local package and ABS databases against repositories + +* pacinsd +Install given package(s) as dependencies of another package + +* pacmir +Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + +* paclist +List all installed packages with a short description - Source + +* paclsorphans +List all orphaned packages + +* pacrmorphans +Delete all orphaned packages + +* pacdisowned | less +F +List all disowned files in your system + + +# Based on aliases from oh-my-zsh + +Source: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/archlinux/archlinux.plugin.zsh diff --git a/plugins/archlinux/pacman/pacdisowned.fish b/plugins/archlinux/pacman/pacdisowned.fish new file mode 100644 index 0000000..d4c100c --- /dev/null +++ b/plugins/archlinux/pacman/pacdisowned.fish @@ -0,0 +1,18 @@ +# TODO: Need to convert to fish +function pacdisowned + # tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ + # db=$tmp/db + # fs=$tmp/fs + + # mkdir "$tmp" + # trap 'rm -rf "$tmp"' EXIT + + # pacman -Qlq | sort -u > "$db" + + # find /bin /etc /lib /sbin /usr \ + # ! -name lost+found \ + # \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + # comm -23 "$fs" "$db" +end + diff --git a/plugins/archlinux/pacman/pacin.fish b/plugins/archlinux/pacman/pacin.fish new file mode 100644 index 0000000..07b2783 --- /dev/null +++ b/plugins/archlinux/pacman/pacin.fish @@ -0,0 +1,3 @@ +function pacin -d "Install specific package(s) from the repositories" + sudo pacman -S $argv +end diff --git a/plugins/archlinux/pacman/pacins.fish b/plugins/archlinux/pacman/pacins.fish new file mode 100644 index 0000000..4456eaf --- /dev/null +++ b/plugins/archlinux/pacman/pacins.fish @@ -0,0 +1,3 @@ +function pacins -d "Install specific package not from the repositories but from a file" + sudo pacman -U $argv +end diff --git a/plugins/archlinux/pacman/paclist.fish b/plugins/archlinux/pacman/paclist.fish new file mode 100644 index 0000000..6d83286 --- /dev/null +++ b/plugins/archlinux/pacman/paclist.fish @@ -0,0 +1,3 @@ +function paclist + sudo pacman -Qei (pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' +end diff --git a/plugins/archlinux/pacman/pacloc.fish b/plugins/archlinux/pacman/pacloc.fish new file mode 100644 index 0000000..61f3e01 --- /dev/null +++ b/plugins/archlinux/pacman/pacloc.fish @@ -0,0 +1,3 @@ +function pacloc -d "Display information about a given package in the local database" + pacman -Qi $argv +end diff --git a/plugins/archlinux/pacman/paclocs.fish b/plugins/archlinux/pacman/paclocs.fish new file mode 100644 index 0000000..10aacbd --- /dev/null +++ b/plugins/archlinux/pacman/paclocs.fish @@ -0,0 +1,3 @@ +function paclocs -d "Search for package(s) in the local database" + sudo pacman -Qs $argv +end diff --git a/plugins/archlinux/pacman/paclsorphans.fish b/plugins/archlinux/pacman/paclsorphans.fish new file mode 100644 index 0000000..7d1b334 --- /dev/null +++ b/plugins/archlinux/pacman/paclsorphans.fish @@ -0,0 +1,3 @@ +function paclsorphans -d "Display a list of packages that were installed as dependencies but are no longer required by any installed package" + pacman -Qdt $argv +end diff --git a/plugins/archlinux/pacman/pacmanallkeys.fish b/plugins/archlinux/pacman/pacmanallkeys.fish new file mode 100644 index 0000000..6b2884b --- /dev/null +++ b/plugins/archlinux/pacman/pacmanallkeys.fish @@ -0,0 +1,7 @@ +# TODO: Need to convert to fish +function pacmanallkeys +# Get all keys for developers and trusted users +#curl https://www.archlinux.org/{developers,trustedusers}/ | +#awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | +#xargs sudo pacman-key --recv-keys +end diff --git a/plugins/archlinux/pacman/pacmansignkeys.fish b/plugins/archlinux/pacman/pacmansignkeys.fish new file mode 100644 index 0000000..4349d5a --- /dev/null +++ b/plugins/archlinux/pacman/pacmansignkeys.fish @@ -0,0 +1,9 @@ +# TODO: Need to convert to fish +function pacmansignkeys + # for key in $*; do + # sudo pacman-key --recv-keys $key + # sudo pacman-key --lsign-key $key + # printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \ + # --no-permission-warning --command-fd 0 --edit-key $key + # done +end diff --git a/plugins/archlinux/pacman/pacmir.fish b/plugins/archlinux/pacman/pacmir.fish new file mode 100644 index 0000000..58f1982 --- /dev/null +++ b/plugins/archlinux/pacman/pacmir.fish @@ -0,0 +1,3 @@ +function pacmir -d "Force refresh of all package lists after updating /etc/pacman.d/mirrorlist" + sudo pacman -Syy $argv +end diff --git a/plugins/archlinux/pacman/pacre.fish b/plugins/archlinux/pacman/pacre.fish new file mode 100644 index 0000000..94b7b34 --- /dev/null +++ b/plugins/archlinux/pacman/pacre.fish @@ -0,0 +1,3 @@ +function pacre -d "Remove the specified package(s), retaining its configuration(s) and required dependencies" + sudo pacman -R $argv +end diff --git a/plugins/archlinux/pacman/pacrem.fish b/plugins/archlinux/pacman/pacrem.fish new file mode 100644 index 0000000..79fdc27 --- /dev/null +++ b/plugins/archlinux/pacman/pacrem.fish @@ -0,0 +1,3 @@ +function pacrem -d "Remove the specified package(s), its configuration(s) and unneeded dependencies" + sudo pacman -Rns $argv +end diff --git a/plugins/archlinux/pacman/pacrep.fish b/plugins/archlinux/pacman/pacrep.fish new file mode 100644 index 0000000..74dfbec --- /dev/null +++ b/plugins/archlinux/pacman/pacrep.fish @@ -0,0 +1,3 @@ +function pacrep -d "Display information about a given package in the repositories" + pacman -Si $argv +end diff --git a/plugins/archlinux/pacman/pacreps.fish b/plugins/archlinux/pacman/pacreps.fish new file mode 100644 index 0000000..c6ebc78 --- /dev/null +++ b/plugins/archlinux/pacman/pacreps.fish @@ -0,0 +1,3 @@ +function pacreps -d "Search for package(s) in the repositories" + command pacman -Ss $argv +end diff --git a/plugins/archlinux/pacman/pacrmorphans.fish b/plugins/archlinux/pacman/pacrmorphans.fish new file mode 100644 index 0000000..740ac98 --- /dev/null +++ b/plugins/archlinux/pacman/pacrmorphans.fish @@ -0,0 +1,3 @@ +function pacrmorphans -d "Remove all real orphan packages" + sudo pacman -Rs (pacman -Qtdq) $argv +end diff --git a/plugins/archlinux/pacman/pacupd.fish b/plugins/archlinux/pacman/pacupd.fish new file mode 100644 index 0000000..fdd9c64 --- /dev/null +++ b/plugins/archlinux/pacman/pacupd.fish @@ -0,0 +1,10 @@ +which abs ^ /dev/null > /dev/null +if test $status -ne 1 + function pacupd -d "Update and refresh the local package and ABS databases against repositories" + sudo pacman -Sy; and sudo abs + end +else + function pacupd -d "Update and refresh the local package against repositories" + sudo pacman -Sy + end +end diff --git a/plugins/archlinux/pacman/pacupg.fish b/plugins/archlinux/pacman/pacupg.fish new file mode 100644 index 0000000..0f0ee5b --- /dev/null +++ b/plugins/archlinux/pacman/pacupg.fish @@ -0,0 +1,3 @@ +function pacupg -d "Synchronize with repositories before upgrading packages that are out of date on the local system." + sudo pacman -Syu $argv +end From 572b75dfd98c77ae3c4054d6646ff5d3b4ae02f7 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 25 Feb 2014 19:41:24 -0500 Subject: [PATCH 02/11] Fixed incorrect plugin name --- plugins/archlinux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index a5645f4..3e5339b 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -15,7 +15,7 @@ To use this plugin append the following `archlinux` to `fish_plugins`. This plugin makes working work pacman easier and faster. Please refer to pacman/README.md for more information. -To use this plugin append the following `archlinux` to `fish_plugins`. +To use this plugin append the following `archlinux/pacman` to `fish_plugins`. From 5b3f40433e93e64275522007d0baa71df7e60b75 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 25 Feb 2014 22:19:38 -0500 Subject: [PATCH 03/11] Removed command; it's not necessary. --- plugins/archlinux/pacman/pacreps.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/pacman/pacreps.fish b/plugins/archlinux/pacman/pacreps.fish index c6ebc78..8b5e6f3 100644 --- a/plugins/archlinux/pacman/pacreps.fish +++ b/plugins/archlinux/pacman/pacreps.fish @@ -1,3 +1,3 @@ function pacreps -d "Search for package(s) in the repositories" - command pacman -Ss $argv + pacman -Ss $argv end From 8be94d347116f51e79aa9269f7e36173466142ed Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 25 Feb 2014 22:22:03 -0500 Subject: [PATCH 04/11] Fixed typo --- plugins/archlinux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 3e5339b..8c04db1 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -13,7 +13,7 @@ To use this plugin append the following `archlinux` to `fish_plugins`. ## archlinux/pacman -This plugin makes working work pacman easier and faster. Please refer to pacman/README.md for more information. +This plugin makes working with pacman easier and faster. Please refer to pacman/README.md for more information. To use this plugin append the following `archlinux/pacman` to `fish_plugins`. From 217bde59941a3de6080b96a4898f0007a3e07e00 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 26 Feb 2014 17:34:15 -0500 Subject: [PATCH 05/11] Ported function to zsh --- plugins/archlinux/pacman/pacdisowned.fish | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/plugins/archlinux/pacman/pacdisowned.fish b/plugins/archlinux/pacman/pacdisowned.fish index d4c100c..2674882 100644 --- a/plugins/archlinux/pacman/pacdisowned.fish +++ b/plugins/archlinux/pacman/pacdisowned.fish @@ -1,18 +1,23 @@ -# TODO: Need to convert to fish function pacdisowned - # tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ - # db=$tmp/db - # fs=$tmp/fs + if test -d $TMPDIR + set tmp "/tmp" + else + set tmp $TMPDIR + end - # mkdir "$tmp" - # trap 'rm -rf "$tmp"' EXIT + set dir (mktemp -d -p $tmp) - # pacman -Qlq | sort -u > "$db" + set -l fs "$dir/fs" + set -l db "$dir/db" - # find /bin /etc /lib /sbin /usr \ - # ! -name lost+found \ - # \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + pacman -Qlq | sort -u > "$db" - # comm -23 "$fs" "$db" + find /bin /etc /lib /sbin /usr ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" + + # clean-up after ourself + rm -rf "$dir" end From 9e53decf64216fd3a33f8aa7b89605a1cdf658ab Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 26 Feb 2014 17:38:57 -0500 Subject: [PATCH 06/11] Added description --- plugins/archlinux/pacman/pacdisowned.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/pacman/pacdisowned.fish b/plugins/archlinux/pacman/pacdisowned.fish index 2674882..4b851f1 100644 --- a/plugins/archlinux/pacman/pacdisowned.fish +++ b/plugins/archlinux/pacman/pacdisowned.fish @@ -1,4 +1,4 @@ -function pacdisowned +function pacdisowned -d "Display list of disowned files" if test -d $TMPDIR set tmp "/tmp" else From 1df49b6fcdfa1e8f9b9f5478a8ca19fcab3473f4 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 26 Feb 2014 17:39:15 -0500 Subject: [PATCH 07/11] Ported function to zsh --- plugins/archlinux/pacman/pacmanallkeys.fish | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/archlinux/pacman/pacmanallkeys.fish b/plugins/archlinux/pacman/pacmanallkeys.fish index 6b2884b..e1fe816 100644 --- a/plugins/archlinux/pacman/pacmanallkeys.fish +++ b/plugins/archlinux/pacman/pacmanallkeys.fish @@ -1,7 +1,3 @@ -# TODO: Need to convert to fish -function pacmanallkeys -# Get all keys for developers and trusted users -#curl https://www.archlinux.org/{developers,trustedusers}/ | -#awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | -#xargs sudo pacman-key --recv-keys +function pacmanallkeys -d "Get all keys for developers and trusted users" + curl https://www.archlinux.org/developers/ https://www.archlinux.org/trustedusers/ | awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | xargs sudo pacman-key --recv-keys end From 0622fe860fec06c0e9a36a154f1025280671e495 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 26 Feb 2014 17:39:28 -0500 Subject: [PATCH 08/11] Ported function to zsh --- plugins/archlinux/pacman/pacmansignkeys.fish | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/archlinux/pacman/pacmansignkeys.fish b/plugins/archlinux/pacman/pacmansignkeys.fish index 4349d5a..5ad10cb 100644 --- a/plugins/archlinux/pacman/pacmansignkeys.fish +++ b/plugins/archlinux/pacman/pacmansignkeys.fish @@ -1,9 +1,8 @@ -# TODO: Need to convert to fish -function pacmansignkeys - # for key in $*; do - # sudo pacman-key --recv-keys $key - # sudo pacman-key --lsign-key $key - # printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \ - # --no-permission-warning --command-fd 0 --edit-key $key - # done +function pacmansignkeys -d "Allow user to sign keys" + for key in $argv; + sudo pacman-key --recv-keys $key + sudo pacman-key --lsign-key $key + printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \ + --no-permission-warning --command-fd 0 --edit-key $key + end end From d54c53e641c69e04b60c9948da10ff2201b628bd Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Fri, 28 Feb 2014 14:13:59 -0500 Subject: [PATCH 09/11] Fixed Indentation problem --- plugins/archlinux/pacman/pacmanallkeys.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/pacman/pacmanallkeys.fish b/plugins/archlinux/pacman/pacmanallkeys.fish index e1fe816..8dcbba7 100644 --- a/plugins/archlinux/pacman/pacmanallkeys.fish +++ b/plugins/archlinux/pacman/pacmanallkeys.fish @@ -1,3 +1,3 @@ function pacmanallkeys -d "Get all keys for developers and trusted users" - curl https://www.archlinux.org/developers/ https://www.archlinux.org/trustedusers/ | awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | xargs sudo pacman-key --recv-keys + curl https://www.archlinux.org/developers/ https://www.archlinux.org/trustedusers/ | awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' | xargs sudo pacman-key --recv-keys end From 1771eec8e35882c11924e1850f9a150aae41530b Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Fri, 28 Feb 2014 14:14:48 -0500 Subject: [PATCH 10/11] Removed unnecessary sudo --- plugins/archlinux/pacman/paclist.fish | 2 +- plugins/archlinux/pacman/paclocs.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/archlinux/pacman/paclist.fish b/plugins/archlinux/pacman/paclist.fish index 6d83286..2c777f4 100644 --- a/plugins/archlinux/pacman/paclist.fish +++ b/plugins/archlinux/pacman/paclist.fish @@ -1,3 +1,3 @@ function paclist - sudo pacman -Qei (pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' + pacman -Qei (pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' end diff --git a/plugins/archlinux/pacman/paclocs.fish b/plugins/archlinux/pacman/paclocs.fish index 10aacbd..5f6ae70 100644 --- a/plugins/archlinux/pacman/paclocs.fish +++ b/plugins/archlinux/pacman/paclocs.fish @@ -1,3 +1,3 @@ function paclocs -d "Search for package(s) in the local database" - sudo pacman -Qs $argv + pacman -Qs $argv end From eef0fb484fbe7dde5371c596ef4f6f16e528481e Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Fri, 28 Feb 2014 14:48:45 -0500 Subject: [PATCH 11/11] Corrected logic when testing if exists. --- plugins/archlinux/pacman/pacdisowned.fish | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/archlinux/pacman/pacdisowned.fish b/plugins/archlinux/pacman/pacdisowned.fish index 4b851f1..2f0f012 100644 --- a/plugins/archlinux/pacman/pacdisowned.fish +++ b/plugins/archlinux/pacman/pacdisowned.fish @@ -1,10 +1,9 @@ function pacdisowned -d "Display list of disowned files" - if test -d $TMPDIR - set tmp "/tmp" - else + if test -d "$TMPDIR" set tmp $TMPDIR + else + set tmp "/tmp" end - set dir (mktemp -d -p $tmp) set -l fs "$dir/fs"