mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-04-25 21:49:12 -04:00
output
This commit is contained in:
parent
c069c73109
commit
bc768aa196
@ -21,20 +21,26 @@ if [ -f /usr/libexec/helper-scripts/pre.bsh ]; then
|
|||||||
source /usr/libexec/helper-scripts/pre.bsh
|
source /usr/libexec/helper-scripts/pre.bsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -o xtrace ; then
|
||||||
|
output_command=true
|
||||||
|
else
|
||||||
|
output_command=echo
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e /etc/remount-disable ] || [ -e /usr/local/etc/remount-disable ]; then
|
if [ -e /etc/remount-disable ] || [ -e /usr/local/etc/remount-disable ]; then
|
||||||
echo "INFO: file /etc/remount-disable exists. Doing nothing."
|
$output_command "INFO: file /etc/remount-disable exists. Doing nothing."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e /etc/exec ] || [ -e /usr/local/etc/exec ]; then
|
if [ -e /etc/exec ] || [ -e /usr/local/etc/exec ]; then
|
||||||
noexec=false
|
noexec=false
|
||||||
echo "INFO: Will remount with exec because file /etc/exec or /usr/local/etc/exec exists."
|
$output_command "INFO: Will remount with exec because file /etc/exec or /usr/local/etc/exec exists."
|
||||||
else
|
else
|
||||||
if [ -e /etc/noexec ] || [ -e /usr/local/etc/noexec ]; then
|
if [ -e /etc/noexec ] || [ -e /usr/local/etc/noexec ]; then
|
||||||
noexec=true
|
noexec=true
|
||||||
echo "INFO: Will remount with noexec because file /etc/noexec or /usr/local/etc/noexec exists."
|
$output_command "INFO: Will remount with noexec because file /etc/noexec or /usr/local/etc/noexec exists."
|
||||||
else
|
else
|
||||||
echo "INFO: Will not remount with noexec because file /etc/noexec or /usr/local/etc/noexec does not exist."
|
$output_command "INFO: Will not remount with noexec because file /etc/noexec or /usr/local/etc/noexec does not exist."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -71,23 +77,23 @@ remount_secure() {
|
|||||||
mount_line_of_mount_folder="$(echo "$mount_output" | grep "$mount_folder ")" || true
|
mount_line_of_mount_folder="$(echo "$mount_output" | grep "$mount_folder ")" || true
|
||||||
|
|
||||||
if echo "$mount_line_of_mount_folder" | grep --quiet "$new_mount_options" ; then
|
if echo "$mount_line_of_mount_folder" | grep --quiet "$new_mount_options" ; then
|
||||||
echo "INFO: $mount_folder has already intended mount options."
|
$output_command "INFO: $mount_folder has already intended mount options."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$status_file_full_path" ]; then
|
if [ -e "$status_file_full_path" ]; then
|
||||||
echo "INFO: $mount_folder already remounted earlier. Not remounting again."
|
$output_command "INFO: $mount_folder already remounted earlier. Not remounting again."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## BUG: echo: write error: Broken pipe
|
## BUG: echo: write error: Broken pipe
|
||||||
if echo "$mount_output" | grep --quiet "$mount_folder " ; then
|
if echo "$mount_output" | grep --quiet "$mount_folder " ; then
|
||||||
## Already mounted. Using remount.
|
## Already mounted. Using remount.
|
||||||
echo mount -o "remount,${new_mount_options}" "$mount_folder"
|
$output_command mount -o "remount,${new_mount_options}" "$mount_folder"
|
||||||
mount -o "remount,${new_mount_options}" "$mount_folder" || exit_code=100
|
mount -o "remount,${new_mount_options}" "$mount_folder" || exit_code=100
|
||||||
else
|
else
|
||||||
## Not yet mounted. Using mount bind.
|
## Not yet mounted. Using mount bind.
|
||||||
echo mount -o "$new_mount_options" --bind "$mount_folder" "$mount_folder"
|
$output_command mount -o "$new_mount_options" --bind "$mount_folder" "$mount_folder"
|
||||||
mount -o "$new_mount_options" --bind "$mount_folder" "$mount_folder" || exit_code=101
|
mount -o "$new_mount_options" --bind "$mount_folder" "$mount_folder" || exit_code=101
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user