kas-docker: made loop back device setup more idiot proof
I understood the message: Setting up loop device requires root privileges as suggestion that I should start this script as root and hit ^C before `sudo` could prompt for my password. This patch removes that line and adds a sudo prompt to elaborate on why root permissions are needed and what is done with them. It also adds a check if this was unsuccessful and suggests to the user to do it themselves. This will also be shown if sudo is not installed. Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
parent
90ae592ff1
commit
98b4d888bc
13
kas-docker
13
kas-docker
@ -66,8 +66,17 @@ while [ $# -gt 0 ]; do
|
||||
echo "Error: loop device not available!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Setting up loop device requires root privileges"
|
||||
LOOP_DEV=$(sudo /sbin/losetup -f)
|
||||
sudo_command="/sbin/losetup -f"
|
||||
sudo_message="[sudo] enter password to setup loop"
|
||||
sudo_message="$sudo_message devices by calling"
|
||||
sudo_message="$sudo_message '$sudo_command': "
|
||||
if ! LOOP_DEV=$(sudo -p "$sudo_message" $sudo_command \
|
||||
2>/dev/null); then
|
||||
echo "Error: loop device setup unsuccessful!"
|
||||
echo "try calling '$sudo_command' with root" \
|
||||
"permissions manually."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
ISAR_ARGS="--cap-add=SYS_ADMIN --cap-add=MKNOD --privileged \
|
||||
--device ${LOOP_DEV}"
|
||||
|
Loading…
Reference in New Issue
Block a user