#!/bin/sh - # # Toggle writable state of the disk # # Rick van der Zwet # mount -p | awk '{if($2 == "/"){ print $4}}' | grep -q ro && { mount -uwo noatime / mount -wo noatime /cfg echo "# / - write" echo "# /cfg - write" echo "# Run again to protect" } || { mount -ur / umount /cfg echo "# / - read" echo "# /cfg - ejected" echo "# Run again to edit" }