scripts/remountrw

29 lines
704 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# Remount some partitions with less restrictive permissions, e.g:
# * to be able to run updates (apt, dpkg, grub,…)
if [ "$(id -u)" -eq 0 ]; then
# RW permissions
## get the mountpath list from fstab
for mountpath in /boot /opt /usr /var; do
# ensure "${mountpath}" is already mounted
if grep -q " ${mountpath} " /etc/mtab; then
mount "${mountpath}" -o remount,rw,suid,dev
fi
done
# EXEC + RW permissions
## get the mountpath list from fstab
for mountpath in /tmp /var/tmp /dev/shm; do
# ensure "${mountpath}" is already mounted
if grep -q " ${mountpath} " /etc/mtab; then
mount "${mountpath}" -o remount,rw,suid,dev,exec
fi
done
else
sudo "${0}"
fi
exit 0