-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvars.include.example
executable file
·140 lines (107 loc) · 5.58 KB
/
vars.include.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/false
# Note: if your vars.include version does not match the one from
# vars.include.example, then it means new variables have bee added. Please
# paste any new variables from the example file into your vars.include file,
# otherwise the script will refuse to run.
export VERSION="2.0.0"
## === Configure this section before running ================================ #
# The dirs we want sent to the ramdisk. We don't include dirs like /proc, /sys,
# and /run, because those don't actually reside on the disk, and messing with
# them can be problematic. /dev is also unneeded. Please ensure all these dirs
# are absolute paths. Paths with spaces are supported. Don't trail with commas.
declare -ax OS_DIRS=('/bin' '/etc' '/lib' '/lib64' '/sbin' '/usr' '/var' '/tmp')
# This is needed to stop the display manager. If in doubt, stop your DM
# manually before running the main script.
export DM_STOP_COMMAND='service lightdm stop'
# Dir containing all user homes.
export HOME_DIR='/home'
## === Common options ======================================================= #
# If this is '1', ensures you have enough RAM before starting. This is sort of
# system-dependent, and I'm unsure how to make it properly cross-OS compatible.
# Set to '0' to skip checking if your system has enough RAM.
#
# If set to '1', ramdisk size will be minimum RAM needed + ADDITIONAL_RAM_GB.
# If set to '0', exactly half of your total RAM will be assigned to the ramdisk
# (note that the RAM won't actually be used until it is needed).
export CHECK_AVAILABLE_RAM='1'
# Amount of extra RAM in GB to add to the ramdisk's total capacity. Ignored if
# CHECK_AVAILABLE_RAM is set to '0'.
export ADDITIONAL_RAM_GB='2'
# If you want specific dirs in your home sent to RAM, specify them here. This
# is completely optional. Don't trail with commas.
# Example:
# HOME_DIR_OVERRIDES=('/home/user/SomeDir' '/home/user/dir with spaces')
declare -ax HOME_DIR_OVERRIDES=(
# one quoted directory per line; don't trail with commas.
)
## === Advanced options ===================================================== #
# Ignored if HOME_MOUNT_COMMAND is empty.
# This will be used as the physical location for the original home that has no
# overrides to make it part-RAM. It will be created if it does not exist.
# To keep the mount command simple, this path does not support spaces.
export HOME_UNADULTERATED='/mnt/physical_home_1166877'
# Leave this empty if you don't care about advanced features in runtime_utils.
# This is useful for running aftercare commands later, such as syncing home
# overrides back to the real disk. Note that it can't be used to sync OS files
# back to the physical disk, only home overrides.
#
# Example where home is located on the / partition, on sda1:
# export HOME_MOUNT_COMMAND="mount /dev/sda1 $HOME_UNADULTERATED"
# Example where home has a dedicated partition, say, sda3:
# export HOME_MOUNT_COMMAND="mount /dev/sda3 $HOME_UNADULTERATED"
export HOME_MOUNT_COMMAND=""
# Leave this empty if HOME_MOUNT_COMMAND is empty.
#
# Example where home is located on the / partition, on sda1:
# export HOME_SYNC_LOCATION="$HOME_UNADULTERATED/home"
# Example where home has a dedicated partition, say, sda3:
# export HOME_SYNC_LOCATION="$HOME_UNADULTERATED"
export HOME_SYNC_LOCATION=""
# Where our ramdisk resides.
export RAMDISK_DIR='/mnt/ram_os_1166877'
# If set to '1', the application will run "sysctl -p" once everything
# completes, which forces the system to recognise the new /etc/sysctl.conf
# file. If in doubt, leave this as '0'.
export UPDATE_SYSCTL='0'
# Command used to copy directories. Note that, if changing to something other
# than rsync, you'll need to choose a tool capable of merging directories and
# that understands "--delete".
# Change -a to -av if you want a full list of files being copied.
export RSYNC='rsync -a'
## === Live OS substitution ================================================= #
# This should be '/' in most cases. This variable is useful if you want to
# switch to a completely different OS live, such as a different OS install or a
# chroot. If in doubt, leave it as '/'.
#
# If this variable this is not '/', then it is selectively prepended to OS_DIRS
# and HOME_DIR_OVERRIDES items such that the contents of OS_ROOT becomes the
# new OS RAM drive. Additionally, the home drive in the phantom OS will take
# the place of /home until reboot. This effectively means you can shallow-boot
# a different OS on the fly, which effectively replaces the host OS until
# reboot.
export OS_ROOT='/'
## === User section end ===================================================== #
# ==================================================== #
# === Please do not edit anything below this point === #
# ==================================================== #
# Makes scripts act more consistent across different systems.
export POSIXLY_CORRECT=1
# Sanity check.
test -d "$OS_ROOT" || (echo "Error: requested os root '$OS_ROOT' does not exist" && exit 1)
# Generic safety checks. More advanced tests are done in the main scripts.
if test -z "$HOME_DIR" || test -z "$RAMDISK_DIR" || test -z "$HOME_UNADULTERATED" || \
test -z "$OS_DIRS" || test -z "$DM_STOP_COMMAND";
then
echo 'One of more required dirs are empty in vars.include'
echo 'Please see vars.include.example for examples.'
exit 1
fi
# Generic safety checks. More advanced tests are done in the main scripts.
if [ "$HOME_DIR" = '/' ] || [ "$RAMDISK_DIR" = '/' ] || \
[ "$HOME_UNADULTERATED" = '/' ];
then
echo 'One of more dirs are set to /'
echo 'This is dangerous, and probably means you misunderstand what this '
echo 'script does. Please choose a path in /mnt instead'
exit 1
fi