-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathramdisk.sh
More file actions
executable file
·35 lines (27 loc) · 905 Bytes
/
Copy pathramdisk.sh
File metadata and controls
executable file
·35 lines (27 loc) · 905 Bytes
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
_mount_dir() {
if [ $# == 1 ]; then
rsync -a /$1/ /mnt/.ramdisk/$1 --exclude src --exclude cache --exclude db --exclude portage --exclude python --exclude llvm --exclude repos --exclude binpkgs --exclude distfiles
fi
}
start() {
rm -r /mnt/.ramdisk 2>/dev/null
rm -r /var/log/* 2>/dev/null
rm -r /var/tmp/* 2>/dev/null
sync && echo 3 > /proc/sys/vm/drop_caches
mkdir -p /mnt/.ramdisk/{boot,dev,etc,mnt,proc,root,run,sys,tmp,usr,var}
cd /mnt/.ramdisk
echo
echo -e "Prepare ramdisk..."
echo -e "etc,root,usr,var"
for dir in etc root usr var
do
echo -e "/$dir ..."
_mount_dir $dir
done
ln -sfv usr/bin bin
ln -sfv usr/lib lib
ln -sfv usr/lib64 lib64
ln -sfv usr/bin sbin
echo -e "done"
}
start