#!/bin/bash manjaro_os(){ install_log="$ldir/os-install.log"; failed=0; prefix="sudo"; packages=""; echo -n >"$install_log" &2>/dev/null; echo -e "$w_l\n INSTALLATION\n ============\n"; [ -f /etc/lsb-release ] && source /etc/lsb-release; manjaro_version=$DISTRIB_RELEASE # without sudo no user installation allowed hash sudo 2>/dev/null || { [ "$(whoami)" != "root" ] && { echo -e "$r_l You need to be root for that!\n"; return 1; } } # root needs no sudo [ "$(whoami)" == "root" ] && prefix=""; for e in "${binvars[@]}"; do if ! hash "$e" 2>/dev/null; then inst="$e"; case $e in svn) inst="subversion"; ;; xz) inst="xz-utils"; ;; scp) inst="scponly"; ;; makeinfo) inst="texinfo"; ;; python3-config) inst="python3-devel"; ;; libtool|libtoolize) inst="libtool"; ;; composite) inst="imagemagick"; ;; cmp) inst="diffutils"; ;; esac; echo -e "$w_l select $g_l$e$y_l\tfrom: $inst"; packages="$packages $inst"; fi; done; for e in "${headervars[@]}"; do e1=$(find /usr/include/* |grep -m1 "$e"); if [ ! ${#e1} -gt 8 ]; then case $e in crypto.h) inst="libssl-dev"; ;; libusb.h) inst="libusb-1.0.0-dev"; ;; pcsclite.h) inst="pcsclite"; ;; pthread.h) inst="libc-dev-bin"; ;; ncurses) inst="ncurses"; ;; libacl.h) inst="acl"; ;; sys/capability.h) inst="libcap"; ;; readline.h) inst="readline"; ;; glib-2.0/glib.h) inst="glib2"; ;; esac; echo -e "$w_l select $g_l$e$y_l\tfrom: $inst"; packages="$packages $inst"; fi; done; for e in "${libvars[@]}"; do e1=$(find /usr/lib* |grep -m1 "$e"); if [ ! ${#e1} -gt 8 ]; then case $e in libccidtwin.so) inst="ccid"; ;; libstdc++.so.6) inst="gcc-libs"; ;; esac; echo -e "$w_l select $g_l$e$y_l\tfrom: $inst"; packages="$packages $inst"; fi; done; if [ "$(uname -m)" == "x86_64" ] && [ ! -f /usr/lib/libz.so ]; then if [ ! -f /usr/lib/libz.so ]; then e="zlib32"; inst="lib32-zlib"; echo -e "$w_l select $g_l$e$y_l\tfrom: $inst"; packages="$packages $inst"; fi fi if [ ${#packages} -gt 0 ]; then echo -n -e "$w_l update$g_l package list..."; echo "+++ $(date): pacman -Syu" >> "$install_log" $prefix pacman -Syu >> "$install_log" 2>&1; echo -e "$y_l done"; echo -n -e "$w_l install$g_l selected packages$y_l please wait..."; echo "+++ $(date): pacman -Sy install$packages" >> "$install_log" $prefix pacman -S --noconfirm $packages >> "$install_log" 2>&1 || failed=1; if [ $failed == 0 ]; then echo -e "$y_l done"; else echo -e "$r_l failed!"; fi fi [ $failed == 1 ] && echo -e "\n$r_l Installation with errors - see: $install_log"; return $failed; }