-
Notifications
You must be signed in to change notification settings - Fork 0
/
.profile
30 lines (27 loc) · 834 Bytes
/
.profile
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
alias clean="./clean.sh"
alias build="./build.sh"
alias wicinst="./wicinst.sh"
alias wicshell="./wicshell.sh"
alias wicqemu="./start-qemu.sh"
alias makeova="./makeova.sh"
alias buildperf="./check-build-perform.sh"
function 7z() {
local total_ram used_ram limit
# Get the total amount of RAM
total_ram=$(free -b | awk '/^Mem:/{print $2}')
# Get the amount of used RAM
used_ram=$(free -b | awk '/^Mem:/{print $3}')
# Set a limit on the amount of RAM that can be used by the 7z process
# as the total amount of RAM minus the used RAM
limit=$(( total_ram - used_ram ))
if ulimit -v | grep -q unlimited; then
ulimit -v $limit
else
declare -i ulim=$(ulimit -v)
if [ $ulim -gt $limit ]; then
ulimit -v $limit
fi
fi
command 7z "$@"
}
export -f 7z