From 1698398c461a8c5144f86110fcb9647a04f5c63e Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 22 Feb 2019 02:04:38 +0000 Subject: [PATCH] etc/profile.d/functions --- etc/cron.weekly/clean-dirs | 2 +- etc/profile.d/functions | 15 ++++++++------- etc/profile.d/linux.sh | 5 +++++ 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 etc/profile.d/linux.sh diff --git a/etc/cron.weekly/clean-dirs b/etc/cron.weekly/clean-dirs index 7cc7dad1..cb2af863 100755 --- a/etc/cron.weekly/clean-dirs +++ b/etc/cron.weekly/clean-dirs @@ -69,7 +69,7 @@ fi ( [ -n "$LOCATE" ] && which locate 1>/dev/null 2>&1 && locate $LOCATE & if [ -n "$DIRS" -a -n "$DAYS" ]; then - eval find $DIRS -mindepth 1 -type f -mtime $DAYS + eval find $DIRS -mindepth 1 -not -type d -mtime $DAYS eval find $DIRS -mindepth 1 -type d -mtime $DAYS -empty -prune fi ) 2>/dev/null | while IFS= read -r path; do diff --git a/etc/profile.d/functions b/etc/profile.d/functions index e00eafef..97ebb4a7 100755 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -5,10 +5,10 @@ ################################################################################# type -P which > /dev/null || which() { type -P "$1" 2>&1; } type -P nproc > /dev/null || nproc() { - case "$OSTYPE" in - darwin*) sysctl -n hw.ncpu ;; - *) awk '/^processor/ {++n} END {print n}' /proc/cpuinfo ;; - esac + case "$OSTYPE" in + darwin*) sysctl -n hw.ncpu ;; + *) awk '/^processor/ {++n} END {print n}' /proc/cpuinfo ;; + esac } nb_repos() { @@ -23,9 +23,10 @@ nb_repos() { # Realpath #ls -d1 $(grep -v '^ *\(#\|$\)' "$conf") 2>/dev/null - local IFS=" -" - for dir in $(eval ls -d1 $(grep -v '^ *\(#\|$\)' "$conf") 2>/dev/null); do +# NB 22.02.19 local IFS=" +# NB 22.02.19 " +# NB 22.02.19 for dir in $(eval ls -d1 $(grep -v '^ *\(#\|$\)' "$conf") 2>/dev/null); do + eval ls -d1 $(grep -v '^ *\(#\|$\)' "$conf") 2>/dev/null | while read dir; do # Accept directories or files (ex: use to tag a directory: .nb-install) [ -f "$dir" ] && dir=$(dirname "$dir") diff --git a/etc/profile.d/linux.sh b/etc/profile.d/linux.sh new file mode 100644 index 00000000..c2710525 --- /dev/null +++ b/etc/profile.d/linux.sh @@ -0,0 +1,5 @@ +case "$OSTYPE" in linux*) [ 1 ] ;; *) return ;; esac + +modprobe_ls() { + find /lib/modules/$(uname -r) -type f -name '*.ko' | sed -E -e 's,^.*/([^/]+)\.ko$,\1,' +} -- 2.47.3