Files
snapd/tests/completion/lib.exp0
Valentin David a1cb7ae352 many: Install bash completion files in writable directory
Snapd installs bash completion files from snaps in
`/usr/share/bash-completion/completions` which in some distributions
is a read-only filesystem.

Instead of installing them in `/usr` we can install them within
`/var/lib/snapd` which should always be writable.

Because `/var/lib/snapd/desktop` is already in `XDG_DATA_DIRS`, we can
save the files there.

Because bash-completion 2.1 and prior do not support `XDG_DATA_DIRS`,
on older distributions, the legacy path
`/usr/share/bash-completion/completions` will still be used.
2022-06-03 10:38:37 +02:00

71 lines
1.2 KiB
Tcl
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- tcl -*-
set send_slow {1 0.001}
set timeout 30
proc delay {} {
sleep 0.5
}
proc chat {outstr instr {keep false}} {
send -s $outstr
delay
if $keep {
expect {
timeout {puts "timeout"; exit 1}
-notransfer $instr
}
} else {
expect {
timeout {puts "timeout"; exit 1}
$instr
}
}
}
proc rechat {outstr inre {keep false}} {
send -s $outstr
delay
if $keep {
expect {
timeout {puts "timeout"; exit 1}
-notransfer -re $inre
}
} else {
expect {
timeout {puts "timeout"; exit 1}
-re $inre
}
}
}
proc next {} {
delay
expect {
timeout {puts "timeout"; exit 1}
{bash-*[$#] $}
}
}
proc cancel {} {
send -s " \r"
next
}
proc brexit {} {
send -s "exit\r"
expect {
timeout {puts "timeout"; exit 1}
eof {exit 0}
}
}
# Set up and ensure we have an empty environment as on some systems
# (debian) PS1 leaks into the newly spawned shell which causes our
# tests to fail.
spawn env -u PS1 bash --norc -i
next
send ". /usr/share/bash-completion/bash_completion; . ../../../data/completion/bash/snap\n"
next