lazy/run.sh
2024-08-02 19:16:07 +08:00

34 lines
711 B
Bash
Executable File

#!/bin/sh
if [ "$1" = "command" ]; then
echo "Please run the following command to install lazy:"
echo "sh -c \"\$(wget -qO- cc.c-4.cc/lazy.sh)\""
exit 0
fi
scriptdir=$(dirname $(realpath $0))
# ============================================================
git -C $scriptdir pull
$scriptdir/update.sh
if [ "$1" = "update" ]; then
exit 0
fi
if [ "$(id -u)" -eq 0 ]; then
echo "Running in root mode."
$scriptdir/init_root.sh $@
else
sudo_id=$(sudo id -u 2>/dev/null)
if [ $? -eq 0 ] && [ "$sudo_id" -eq 0 ]; then
echo "Running in sudo mode."
$scriptdir/init_sudo.sh $@
else
echo "Running in user mode."
$scriptdir/init_user.sh $@
fi
fi