Install ram disk

This commit is contained in:
Bob Mottram 2016-07-27 20:13:34 +01:00
parent 47156dfcf8
commit 5e5630cc8f
1 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,17 @@ MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
MESH_INSTALL_SETUP=/root/.initial_mesh_setup MESH_INSTALL_SETUP=/root/.initial_mesh_setup
MESH_AMNESIC=/root/.amnesic MESH_AMNESIC=/root/.amnesic
function create_ram_disk {
ramdisk_size_mb=$1
if [ ! -d /mnt/ramdisk ]; then
mkdir -p /mnt/ramdisk
fi
if ! grep -q "ramdisk" /etc/fstab; then
mount -t tmpfs -o size=${ramdisk_size_mb}m tmpfs /mnt/ramdisk
echo "tmpfs /mnt/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=${ramdisk_size_mb}M 0 0" >> /etc/fstab
fi
}
function set_hostname { function set_hostname {
DEFAULT_DOMAIN_NAME="$1" DEFAULT_DOMAIN_NAME="$1"
@ -543,7 +554,7 @@ function mesh_amnesic {
echo 'Type=oneshot' >> /etc/systemd/system/amnesic.service echo 'Type=oneshot' >> /etc/systemd/system/amnesic.service
echo 'RemainAfterExit=true' >> /etc/systemd/system/amnesic.service echo 'RemainAfterExit=true' >> /etc/systemd/system/amnesic.service
echo 'ExecStart=/bin/true' >> /etc/systemd/system/amnesic.service echo 'ExecStart=/bin/true' >> /etc/systemd/system/amnesic.service
echo 'ExecStop=/usr/bin/amnesic' >> /etc/systemd/system/amnesic.service echo "ExecStop=/usr/bin/amnesic $MY_USERNAME" >> /etc/systemd/system/amnesic.service
echo '' >> /etc/systemd/system/amnesic.service echo '' >> /etc/systemd/system/amnesic.service
echo '[Install]' >> /etc/systemd/system/amnesic.service echo '[Install]' >> /etc/systemd/system/amnesic.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/amnesic.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/amnesic.service
@ -599,6 +610,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
echo $'Beginning mesh node setup' >> $INSTALL_LOG echo $'Beginning mesh node setup' >> $INSTALL_LOG
enable_batman_daemon enable_batman_daemon
create_ram_disk 1
change_avahi_name change_avahi_name
regenerate_ssh_host_keys regenerate_ssh_host_keys
configure_zeronet_blog configure_zeronet_blog