mirror of https://github.com/containers/qm.git
36 lines
1.3 KiB
Bash
Executable File
36 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
qm_config_file="/usr/share/containers/systemd/qm.container"
|
|
|
|
# Check if the configuration file exists
|
|
if [ ! -f "$qm_config_file" ]; then
|
|
echo "Configuration file not found: $qm_config_file"
|
|
exit 1
|
|
fi
|
|
|
|
# Extract the root filesystem path using awk
|
|
qm_config_file="/usr/share/containers/systemd/qm.container"
|
|
root_fs=$(awk -F'=' '/Environment=ROOTFS/ { print $3 }' "$qm_config_file")
|
|
|
|
# Error handling for root_fs
|
|
if [ -z "$root_fs" ] || [[ "$root_fs" == "Error: Path too short or improperly formatted" ]]; then
|
|
echo "Failed to retrieve a valid path. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
echo "${root_fs}"
|