diff options
| author | Simon Rettberg | 2014-07-27 00:10:16 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2014-07-27 00:10:16 +0200 |
| commit | 62d78729a32dd136feddede21a5dc6e9c3dbe2d7 (patch) | |
| tree | dccd7c833bb33825c45922397dd84d629d25f05f /remote/includes/paths.inc | |
| parent | [rfs-s31] fix busybox copying v2 (diff) | |
| download | tm-scripts-62d78729a32dd136feddede21a5dc6e9c3dbe2d7.tar.gz tm-scripts-62d78729a32dd136feddede21a5dc6e9c3dbe2d7.tar.xz tm-scripts-62d78729a32dd136feddede21a5dc6e9c3dbe2d7.zip | |
helpers/includes now should include an __init function and not just do stuff right away when being sourced
Diffstat (limited to 'remote/includes/paths.inc')
| -rw-r--r-- | remote/includes/paths.inc | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/remote/includes/paths.inc b/remote/includes/paths.inc index ca692adb..928ca964 100644 --- a/remote/includes/paths.inc +++ b/remote/includes/paths.inc @@ -4,29 +4,28 @@ # by different modules instead of each module determining them on its own. # +__init () { + # Location of PAM-modules + for CANDIDATE in $(strings "$(ldd "$(which login)" | grep libpam.so | head -n 1 | awk '{print $3}')" | grep /lib); do + [ -f "$CANDIDATE/pam_unix.so" ] && declare -rg SYS_PAM_MODULES_PATH="$CANDIDATE" && break + done -# Location of PAM-modules -for CANDIDATE in $(strings "$(ldd "$(which login)" | grep libpam.so | head -n 1 | awk '{print $3}')" | grep /lib); do - [ -f "$CANDIDATE/pam_unix.so" ] && declare -rg SYS_PAM_MODULES_PATH="$CANDIDATE" && break -done + [ -z "$SYS_PAM_MODULES_PATH" ] && perror "Failed to find pam_unix.so on this system." -[ -z "$SYS_PAM_MODULES_PATH" ] && perror "Failed to find pam_unix.so on this system." + # + # Figure out if we have split usr + if [ -L "/bin" -a -L "/lib" ]; then + declare -rg USR_SPLIT="no" + else + declare -rg USR_SPLIT="yes" + fi + pdebug "/bin and /lib are split from /usr/bin and /usr/lib (they are not symlinks): $USR_SPLIT" -# -# Figure out if we have split usr -if [ -L "/bin" -a -L "/lib" ]; then - declare -rg USR_SPLIT="no" -else - declare -rg USR_SPLIT="yes" -fi -pdebug "/bin and /lib are split from /usr/bin and /usr/lib (they are not symlinks): $USR_SPLIT" - -SYS_LIB_PATHS="" -for DIR in /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64; do - [ -d "$DIR" -a ! -L "$DIR" ] && SYS_LIB_PATHS+=" $DIR" -done -declare -rg SYS_LIB_PATHS=$SYS_LIB_PATHS -pdebug "System lib paths: $SYS_LIB_PATHS" - -true + SYS_LIB_PATHS="" + for DIR in /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64; do + [ -d "$DIR" -a ! -L "$DIR" ] && SYS_LIB_PATHS+=" $DIR" + done + declare -rg SYS_LIB_PATHS=$SYS_LIB_PATHS + pdebug "System lib paths: $SYS_LIB_PATHS" +} |
