Skip to content
Snippets Groups Projects
Unverified Commit 61008d34 authored by Batuhan Osman Taşkaya's avatar Batuhan Osman Taşkaya Committed by GitHub
Browse files

Indentetion

parent 83adf987
No related branches found
No related tags found
1 merge request!45General Indentation Fixment
...@@ -13,114 +13,114 @@ MODULES_LOAD="/etc/modules-load.d" ...@@ -13,114 +13,114 @@ MODULES_LOAD="/etc/modules-load.d"
# param 1: modules to load # param 1: modules to load
# param 2: blacklisted modules # param 2: blacklisted modules
set_modules() { set_modules() {
echo "##" > "/etc/modprobe.d/mhwd-gpu.conf" echo "##" > "/etc/modprobe.d/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "/etc/modprobe.d/mhwd-gpu.conf" echo "## Generated by mhwd - Manjaro Hardware Detection" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo "##" >> "/etc/modprobe.d/mhwd-gpu.conf" echo "##" >> "/etc/modprobe.d/mhwd-gpu.conf"
echo " " >> "/etc/modprobe.d/mhwd-gpu.conf" echo " " >> "/etc/modprobe.d/mhwd-gpu.conf"
for module in $2 for module in $2
do do
echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-gpu.conf" echo "blacklist ${module}" >> "/etc/modprobe.d/mhwd-gpu.conf"
# Unload module if X is not running # Unload module if X is not running
if [ ! "$(pgrep X)" ]; then if [ ! "$(pgrep X)" ]; then
rmmod -f ${module} rmmod -f ${module}
fi fi
done done
echo "##" > "${MODULES_LOAD}/mhwd-gpu.conf" echo "##" > "${MODULES_LOAD}/mhwd-gpu.conf"
echo "## Generated by mhwd - Manjaro Hardware Detection" >> "${MODULES_LOAD}/mhwd-gpu.conf" echo "## Generated by mhwd - Manjaro Hardware Detection" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo "##" >> "${MODULES_LOAD}/mhwd-gpu.conf" echo "##" >> "${MODULES_LOAD}/mhwd-gpu.conf"
echo " " >> "${MODULES_LOAD}/mhwd-gpu.conf" echo " " >> "${MODULES_LOAD}/mhwd-gpu.conf"
for module in $1 for module in $1
do do
echo "${module}" >> "${MODULES_LOAD}/mhwd-gpu.conf" echo "${module}" >> "${MODULES_LOAD}/mhwd-gpu.conf"
# Load module if X is not running # Load module if X is not running
if [ ! "$(pgrep X)" ]; then if [ ! "$(pgrep X)" ]; then
modprobe ${module} modprobe ${module}
fi fi
done done
} }
# param 1: Xorg configuration file # param 1: Xorg configuration file
set_xorg() set_xorg()
{ {
if [ -e "${MHWDXORGCONF}" ]; then if [ -e "${MHWDXORGCONF}" ]; then
rm "${MHWDXORGCONF}" rm "${MHWDXORGCONF}"
fi fi
if [ -e "$1" ]; then if [ -e "$1" ]; then
ln -sf "$1" "${MHWDXORGCONF}" ln -sf "$1" "${MHWDXORGCONF}"
echo "xorg configuration file: '$1'" echo "xorg configuration file: '$1'"
else else
echo "warning: could not find '$1'!" echo "warning: could not find '$1'!"
fi fi
} }
print_link_destination_if_exists() print_link_destination_if_exists()
{ {
if [ -e "$1" ]; then if [ -e "$1" ]; then
echo "$2 '$(readlink "$1")'" echo "$2 '$(readlink "$1")'"
else else
echo "warning: could not find '$1'!" echo "warning: could not find '$1'!"
fi fi
} }
print_status() print_status()
{ {
echo ":: status" echo ":: status"
print_link_destination_if_exists "${MHWDXORGCONF}" " xorg configuration file:" print_link_destination_if_exists "${MHWDXORGCONF}" " xorg configuration file:"
} }
print_help() print_help()
{ {
echo "mhwd-gpu [OPTION] [...]" echo "mhwd-gpu [OPTION] [...]"
echo "" echo ""
echo " --help show help" echo " --help show help"
echo " --status show current status" echo " --status show current status"
echo " --check check for invalid symlinks and repair" echo " --check check for invalid symlinks and repair"
echo " --setxorg [PATH] set xorg configuration file" echo " --setxorg [PATH] set xorg configuration file"
echo " --setmod [nvidia/catalyst] set modules" echo " --setmod [nvidia/catalyst] set modules"
echo "" echo ""
} }
if [ "${PARAM}" -lt 1 ]; then if [ "${PARAM}" -lt 1 ]; then
print_status print_status
exit 0 exit 0
fi fi
for (( I=1; $I <= $PARAM; I++ ));do for (( I=1; $I <= $PARAM; I++ ));do
case "$1" in case "$1" in
--help) --help)
print_help print_help
exit 0 exit 0
;; ;;
--status) --status)
print_status print_status
exit 0 exit 0
;; ;;
--check) --check)
CHECKCONFIG="true" CHECKCONFIG="true"
;; ;;
--setxorg) --setxorg)
shift shift
SETXORGCONF="$1" SETXORGCONF="$1"
;; ;;
--setmod) --setmod)
shift shift
SETMOD="$1" SETMOD="$1"
;; ;;
"") ;; "") ;;
*) *)
echo "error: invalid argument: $1" echo "error: invalid argument: $1"
echo "" echo ""
print_help print_help
exit 1 exit 1
;; ;;
esac esac
shift shift
done done
# Check root # Check root
...@@ -131,25 +131,25 @@ fi ...@@ -131,25 +131,25 @@ fi
# Set Modules # Set Modules
if [ "${SETMOD}" == "nvidia" ]; then if [ "${SETMOD}" == "nvidia" ]; then
set_modules "nvidia" "nouveau ttm drm_kms_helper drm" set_modules "nvidia" "nouveau ttm drm_kms_helper drm"
elif [ "${SETMOD}" == "catalyst" ] || [ "${SETMOD}" == "ati" ]; then elif [ "${SETMOD}" == "catalyst" ] || [ "${SETMOD}" == "ati" ]; then
set_modules "fglrx" "radeon" set_modules "fglrx" "radeon"
elif [ "${SETMOD}" != "" ]; then elif [ "${SETMOD}" != "" ]; then
echo "error: invalid argument '${SETMOD}'" echo "error: invalid argument '${SETMOD}'"
exit 1 exit 1
fi fi
# Set xorg configuration file # Set xorg configuration file
if [ "${SETXORGCONF}" != "" ]; then if [ "${SETXORGCONF}" != "" ]; then
set_xorg "${SETXORGCONF}" set_xorg "${SETXORGCONF}"
fi fi
# Check config # Check config
if [ "${CHECKCONFIG}" == "true" ]; then if [ "${CHECKCONFIG}" == "true" ]; then
if [ -L "${MHWDXORGCONF}" -a ! -e "${MHWDXORGCONF}" ]; then if [ -L "${MHWDXORGCONF}" -a ! -e "${MHWDXORGCONF}" ]; then
echo "'${MHWDXORGCONF}' symlink is invalid! Removing it..." echo "'${MHWDXORGCONF}' symlink is invalid! Removing it..."
rm "${MHWDXORGCONF}" rm "${MHWDXORGCONF}"
elif [ -e "${MHWDXORGCONF}" ]; then elif [ -e "${MHWDXORGCONF}" ]; then
echo "xorg configuration symlink valid..." echo "xorg configuration symlink valid..."
fi fi
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment