Replace which with command -v (#3253)
This commit is contained in:
parent
738975ad56
commit
aaa050959b
@ -238,7 +238,7 @@ create_sources_list()
|
||||
improved_git()
|
||||
{
|
||||
|
||||
local realgit=$(which git)
|
||||
local realgit=$(command -v git)
|
||||
local retries=3
|
||||
local delay=10
|
||||
local count=1
|
||||
|
||||
@ -243,7 +243,7 @@ add_user()
|
||||
rm -f /root/.not_logged_in_yet
|
||||
|
||||
# set up profile sync daemon on desktop systems
|
||||
which psd >/dev/null 2>&1
|
||||
command -v psd >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${RealUserName} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers
|
||||
touch /home/${RealUserName}/.activate_psd
|
||||
@ -358,24 +358,24 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
|
||||
EOF
|
||||
|
||||
# select gnome session (has to be first or it breaks budgie/cinnamon desktop autologin and user-session)
|
||||
[[ -x $(which gnome-session) ]] && sed -i "s/user-session.*/user-session=ubuntu/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(which gnome-session) ]] && sed -i "s/user-session.*/user-session=ubuntu/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
[[ -x $(command -v gnome-session) ]] && sed -i "s/user-session.*/user-session=ubuntu/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(command -v gnome-session) ]] && sed -i "s/user-session.*/user-session=ubuntu/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
|
||||
# select budgie session
|
||||
[[ -x $(which budgie-desktop) ]] && sed -i "s/user-session.*/user-session=budgie-desktop/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(which budgie-desktop) ]] && sed -i "s/user-session.*/user-session=budgie-desktop/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
[[ -x $(command -v budgie-desktop) ]] && sed -i "s/user-session.*/user-session=budgie-desktop/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(command -v budgie-desktop) ]] && sed -i "s/user-session.*/user-session=budgie-desktop/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
|
||||
# select deepin session
|
||||
[[ -x $(which deepin-wm) ]] && sed -i "s/user-session.*/user-session=deepin/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(which deepin-wm) ]] && sed -i "s/user-session.*/user-session=deepin/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
[[ -x $(command -v deepin-wm) ]] && sed -i "s/user-session.*/user-session=deepin/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(command -v deepin-wm) ]] && sed -i "s/user-session.*/user-session=deepin/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
|
||||
# select cinnamon session
|
||||
[[ -x $(which cinnamon) ]] && sed -i "s/user-session.*/user-session=cinnamon/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(which cinnamon) ]] && sed -i "s/user-session.*/user-session=cinnamon/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
[[ -x $(command -v cinnamon) ]] && sed -i "s/user-session.*/user-session=cinnamon/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(command -v cinnamon) ]] && sed -i "s/user-session.*/user-session=cinnamon/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
|
||||
# select mate session
|
||||
[[ -x $(which mate-wm) ]] && sed -i "s/user-session.*/user-session=mate/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(which mate-wm) ]] && sed -i "s/user-session.*/user-session=mate/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
[[ -x $(command -v mate-wm) ]] && sed -i "s/user-session.*/user-session=mate/" /etc/lightdm/lightdm.conf.d/11-armbian.conf
|
||||
[[ -x $(command -v mate-wm) ]] && sed -i "s/user-session.*/user-session=mate/" /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf
|
||||
|
||||
ln -sf /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
|
||||
|
||||
|
||||
@ -92,10 +92,10 @@ log_hardware_info() {
|
||||
grep -v " ram" /proc/partitions >>${Log}
|
||||
echo -e "\n### df:\n" >>${Log}
|
||||
df -h | egrep '^udev|^tmpfs|^/dev/|log2ram|folder2ram' >>${Log}
|
||||
which zpool >/dev/null 2>&1 && echo -e "\n### zpools:\n\n$(zpool list)\n\n### zfs datasets:\n\n$(zfs list)" >>${Log}
|
||||
command -v zpool >/dev/null 2>&1 && echo -e "\n### zpools:\n\n$(zpool list)\n\n### zfs datasets:\n\n$(zfs list)" >>${Log}
|
||||
echo -e "\n### lsblk:\n" >>${Log}
|
||||
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,UUID | grep -v "SWAP" >>${Log}
|
||||
which zramctl >/dev/null 2>&1 && echo -e "\n### zramctl:\n\n$(zramctl)" >>${Log}
|
||||
command -v zramctl >/dev/null 2>&1 && echo -e "\n### zramctl:\n\n$(zramctl)" >>${Log}
|
||||
echo -e "\n### mtab:\n" >>${Log}
|
||||
egrep '^/dev/|\ zfs\ ' /etc/mtab | egrep -v "log2ram|folder2ram" | sort >>${Log}
|
||||
[[ -e /boot/script.bin ]] && echo -e "\n### /boot/script.bin --> $(readlink /boot/script.bin)" >>${Log}
|
||||
|
||||
@ -23,7 +23,7 @@ LOG_OUTPUT="tee -a $LOG2RAM_LOG"
|
||||
|
||||
isSafe () {
|
||||
[ -d $HDD_LOG ] || (echo "ERROR: $HDD_LOG doesn't exist! Can't sync." >&2 ; exit 1)
|
||||
NoCache=$(which nocache 2>/dev/null)
|
||||
NoCache=$(command -v nocache 2>/dev/null)
|
||||
}
|
||||
|
||||
RecreateLogs (){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user