Lines 658-663
Link Here
|
658 |
return 1 |
658 |
return 1 |
659 |
} |
659 |
} |
660 |
|
660 |
|
|
|
661 |
## vserver-support |
662 |
## Idea: we simply check if we are on a root- or v-server and react accordingly. |
663 |
## If there is no "s_context:" at all we have a vanilla (i.e. non-vserver) system |
664 |
## that is treated like a root-server. |
665 |
|
666 |
# void get_vserver_context(void) |
667 |
# |
668 |
# prints the context number if any |
669 |
# |
670 |
get_vserver_context() { |
671 |
[ -f /proc/$$/status ] && awk '/^s_context:/ { print $2; }' /proc/$$/status |
672 |
} |
673 |
|
674 |
# bool is_vserver_host(void) |
675 |
# |
676 |
# return 0 if we are on the host |
677 |
is_vserver_host() { |
678 |
local context=$(get_vserver_context) |
679 |
[ "x${context}" = "x0" -o "x${context}" = "x" ] && return 0 |
680 |
return 1 |
681 |
} |
682 |
|
683 |
# bool is_vserver_guest(void) |
684 |
# |
685 |
# return 0 if we are on the guest |
686 |
is_vserver_guest() { |
687 |
is_vserver_host && return 1 |
688 |
return 0 |
689 |
} |
690 |
|
661 |
|
691 |
|
662 |
############################################################################## |
692 |
############################################################################## |
663 |
# # |
693 |
# # |