Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
initramfs-with-mca
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
initramfs-with-mca
Commits
1f67e310
Commit
1f67e310
authored
May 30, 2022
by
Ophélie Gagnard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test.sh: Initial commit. Function to retrieve the partition names and UUIDs.
parent
497dafb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
test.sh
test.sh
+38
-0
No files found.
test.sh
0 → 100755
View file @
1f67e310
#!/bin/bash
get_partition
()
{
# Return the path of the desired partition.
# Exit and display an error if it finds 0 or several results.
#
# This function should be called with exactly one argument: the desired partition type.
# Its behavior is undefined otherwise.
#echo argument = $1 # DEBUG 100
desired_partitions
=
$(
fdisk
-l
|
grep
"
$1
"
)
#echo desired_partitions = # DEBUG 100
#echo $desired_partitions # DEBUG 100
desired_partition_count
=
$(
echo
-e
"
$desired_partitions
"
|
wc
|
awk
'{print $1}'
)
#echo desired_partition_count = # DEBUG 100
#echo $desired_partition_count # DEBUG 100
if
[
-z
"
$desired_partitions
"
]
;
then
echo
-e
"No partition of type
$1
(should be 1)"
.
exit
elif
[
"
$desired_partition_count
"
-ne
1
]
;
then
echo
-e
"
$desired_partition_count
partitions of type
$1
(should be 1)."
exit
else
#desired_partition_path=$(echo -e "$desired_partitions" | awk '{print $1}')
echo
-e
"
$desired_partitions
"
|
awk
'{print $1}'
fi
}
root_partition_path
=
$(
get_partition
"Linux filesystem"
)
efi_partition_path
=
$(
get_partition
"EFI System"
)
root_partition_id
=
$(
findmnt
-fn
-o
UUID
$root_partition_path
)
efi_partition_id
=
$(
findmnt
-fn
-o
UUID
$efi_partition_path
)
echo
root_partition_path
=
$root_partition_path
echo
efi_partition_path
=
$efi_partition_path
echo
root_partition_id
=
$root_partition_id
echo
efi_partition_id
=
$efi_partition_id
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment