mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
* New store-state tool This is the new store tool inclusing a new test. Also it is included a network-state tool Still missing some parts of the test and a new test for the network state tool. This can be added in a following pr including the migration from the network-state helper to the new tool in all the tests * Fix wording in comment * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 49f30b6a47..92bb6a0664 92bb6a0664 Include snap-sufix in the snaps.name tool 1c8efb77e1 Update default values for wait-for reboot git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 92bb6a066478a46018297e23a409ec01fb682b37 * update tools using lower case vars and scoped vars * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 92bb6a0664..89b9eb5301 89b9eb5301 Update systems supported git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 89b9eb5301b6b8021e42d71162a7d4860279ad0b * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 89b9eb5301..a7164fba07 a7164fba07 remove fedora 35 support, add fedora 37 support git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: a7164fba070cb36fce40714b9a5c84f35867495b * Squashed 'tests/lib/external/snapd-testing-tools/' changes from a7164fba07..3232c5dba7 3232c5dba7 Add support for ubuntu 23.04 git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: 3232c5dba768f226213bfaec56bced7c384f140f * new lines * Squashed 'tests/lib/external/snapd-testing-tools/' changes from 3232c5dba7..d90935d2a4 d90935d2a4 A comment explaining about the default values for wait-for git-subtree-dir: tests/lib/external/snapd-testing-tools git-subtree-split: d90935d2a4000bd17c7a8a2754adb66f8234bb9b * skip ubuntu trusty for store-state test because systemd-run is not supported * Fix systems for store-state test
78 lines
1.6 KiB
Bash
Executable File
78 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
show_help() {
|
|
echo "usage: snaps.name gadget, kernel, core, snap-suffix"
|
|
echo ""
|
|
echo "get the name of a specific snap for the current system"
|
|
}
|
|
|
|
gadget_name() {
|
|
snap list | grep -E '(gadget$|gadget,)' | awk '{ print $1 }'
|
|
}
|
|
|
|
kernel_name(){
|
|
# TODO this may not always be true during remodel scenarios
|
|
# if the old kernel remains
|
|
snap list | grep -E '(kernel$|kernel,)' | awk '{ print $1 }'
|
|
}
|
|
|
|
core_name(){
|
|
local core_name
|
|
core_name="$(snap model --verbose | grep -Po "^base:\\s+\\K.*" || true)"
|
|
if [ -z "$core_name" ]; then
|
|
core_name="core"
|
|
fi
|
|
echo "$core_name"
|
|
}
|
|
|
|
snap_suffix(){
|
|
if os.query is-core18; then
|
|
echo "-core18"
|
|
elif os.query is-core20; then
|
|
echo "-core20"
|
|
elif os.query is-core22; then
|
|
echo "-core22"
|
|
elif os.query is-core24; then
|
|
echo "-core24"
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
if [ $# -eq 0 ]; then
|
|
show_help
|
|
exit 0
|
|
fi
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-h|--help)
|
|
show_help
|
|
exit 0
|
|
;;
|
|
gadget)
|
|
gadget_name
|
|
exit
|
|
;;
|
|
kernel)
|
|
kernel_name
|
|
exit
|
|
;;
|
|
core)
|
|
core_name
|
|
exit
|
|
;;
|
|
snap-suffix)
|
|
snap_suffix
|
|
exit
|
|
;;
|
|
*)
|
|
echo "snaps.name: unknown snap $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
}
|
|
|
|
main "$@"
|