-
Notifications
You must be signed in to change notification settings - Fork 0
/
uname
executable file
·42 lines (33 loc) · 1.05 KB
/
uname
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
#!/bin/bash
# Tool to fake the output in chroot to adjust the
# used kernel version in different Makefiles.
# prepare system by rehash uname from /bin/uname
# to /tmp/uname: "hash -p /tmp/uname uname"
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
if [ $# -eq 0 ]; then
/bin/uname
fi
while getopts "asnrvmpio" opt; do
case "$opt" in
## collection of different output options
### -r ==================================================================
#### return the latest installed kernel version
r) ls /boot/vmlinuz* | sed 's/\/boot\/vmlinuz-//' | sort -V | tail -n1
#### …
# r) …
;;
### -v ==================================================================
#### …
# v) …
# ;;
### -m ==================================================================
#### return maschine arch of an arm hard floating platform
m) echo armhf
;;
# default: just use original to provide output
# currently only working with a single option on the command call
*) /bin/uname -$opt
;;
esac
done