Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
mhwd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
30
Issues
30
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Applications
mhwd
Commits
61008d34
Unverified
Commit
61008d34
authored
Jan 07, 2018
by
Batuhan Osman Taşkaya
Committed by
GitHub
Jan 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indentetion
parent
83adf987
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
95 deletions
+95
-95
scripts/mhwd-gpu
scripts/mhwd-gpu
+95
-95
No files found.
scripts/mhwd-gpu
View file @
61008d34
...
...
@@ -13,114 +13,114 @@ MODULES_LOAD="/etc/modules-load.d"
# param 1: modules to load
# param 2: blacklisted modules
set_modules
()
{
echo
"##"
>
"/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"
for
module
in
$2
do
echo
"blacklist
${
module
}
"
>>
"/etc/modprobe.d/mhwd-gpu.conf"
# Unload module if X is not running
if
[
!
"
$(
pgrep X
)
"
]
;
then
rmmod
-f
${
module
}
fi
done
echo
"##"
>
"
${
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"
for
module
in
$1
do
echo
"
${
module
}
"
>>
"
${
MODULES_LOAD
}
/mhwd-gpu.conf"
# Load module if X is not running
if
[
!
"
$(
pgrep X
)
"
]
;
then
modprobe
${
module
}
fi
done
echo
"##"
>
"/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"
for
module
in
$2
do
echo
"blacklist
${
module
}
"
>>
"/etc/modprobe.d/mhwd-gpu.conf"
# Unload module if X is not running
if
[
!
"
$(
pgrep X
)
"
]
;
then
rmmod
-f
${
module
}
fi
done
echo
"##"
>
"
${
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"
for
module
in
$1
do
echo
"
${
module
}
"
>>
"
${
MODULES_LOAD
}
/mhwd-gpu.conf"
# Load module if X is not running
if
[
!
"
$(
pgrep X
)
"
]
;
then
modprobe
${
module
}
fi
done
}
# param 1: Xorg configuration file
set_xorg
()
{
if
[
-e
"
${
MHWDXORGCONF
}
"
]
;
then
rm
"
${
MHWDXORGCONF
}
"
fi
if
[
-e
"
$1
"
]
;
then
ln
-sf
"
$1
"
"
${
MHWDXORGCONF
}
"
echo
"xorg configuration file: '
$1
'"
else
echo
"warning: could not find '
$1
'!"
fi
if
[
-e
"
${
MHWDXORGCONF
}
"
]
;
then
rm
"
${
MHWDXORGCONF
}
"
fi
if
[
-e
"
$1
"
]
;
then
ln
-sf
"
$1
"
"
${
MHWDXORGCONF
}
"
echo
"xorg configuration file: '
$1
'"
else
echo
"warning: could not find '
$1
'!"
fi
}
print_link_destination_if_exists
()
{
if
[
-e
"
$1
"
]
;
then
echo
"
$2
'
$(
readlink
"
$1
"
)
'"
else
echo
"warning: could not find '
$1
'!"
fi
if
[
-e
"
$1
"
]
;
then
echo
"
$2
'
$(
readlink
"
$1
"
)
'"
else
echo
"warning: could not find '
$1
'!"
fi
}
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
()
{
echo
"mhwd-gpu [OPTION] [...]"
echo
""
echo
" --help show help"
echo
" --status show current status"
echo
" --check check for invalid symlinks and repair"
echo
" --setxorg [PATH] set xorg configuration file"
echo
" --setmod [nvidia/catalyst] set modules"
echo
""
echo
"mhwd-gpu [OPTION] [...]"
echo
""
echo
" --help show help"
echo
" --status show current status"
echo
" --check check for invalid symlinks and repair"
echo
" --setxorg [PATH] set xorg configuration file"
echo
" --setmod [nvidia/catalyst] set modules"
echo
""
}
if
[
"
${
PARAM
}
"
-lt
1
]
;
then
print_status
exit
0
print_status
exit
0
fi
for
((
I
=
1
;
$I
<
=
$PARAM
;
I++
))
;
do
case
"
$1
"
in
--help
)
print_help
exit
0
;;
--status
)
print_status
exit
0
;;
--check
)
CHECKCONFIG
=
"true"
;;
--setxorg
)
shift
SETXORGCONF
=
"
$1
"
;;
--setmod
)
shift
SETMOD
=
"
$1
"
;;
""
)
;;
*
)
echo
"error: invalid argument:
$1
"
echo
""
print_help
exit
1
;;
esac
shift
case
"
$1
"
in
--help
)
print_help
exit
0
;;
--status
)
print_status
exit
0
;;
--check
)
CHECKCONFIG
=
"true"
;;
--setxorg
)
shift
SETXORGCONF
=
"
$1
"
;;
--setmod
)
shift
SETMOD
=
"
$1
"
;;
""
)
;;
*
)
echo
"error: invalid argument:
$1
"
echo
""
print_help
exit
1
;;
esac
shift
done
# Check root
...
...
@@ -131,25 +131,25 @@ fi
# Set Modules
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
set_modules
"fglrx"
"radeon"
set_modules
"fglrx"
"radeon"
elif
[
"
${
SETMOD
}
"
!=
""
]
;
then
echo
"error: invalid argument '
${
SETMOD
}
'"
exit
1
echo
"error: invalid argument '
${
SETMOD
}
'"
exit
1
fi
# Set xorg configuration file
if
[
"
${
SETXORGCONF
}
"
!=
""
]
;
then
set_xorg
"
${
SETXORGCONF
}
"
set_xorg
"
${
SETXORGCONF
}
"
fi
# Check config
if
[
"
${
CHECKCONFIG
}
"
==
"true"
]
;
then
if
[
-L
"
${
MHWDXORGCONF
}
"
-a
!
-e
"
${
MHWDXORGCONF
}
"
]
;
then
echo
"'
${
MHWDXORGCONF
}
' symlink is invalid! Removing it..."
rm
"
${
MHWDXORGCONF
}
"
elif
[
-e
"
${
MHWDXORGCONF
}
"
]
;
then
echo
"xorg configuration symlink valid..."
fi
if
[
-L
"
${
MHWDXORGCONF
}
"
-a
!
-e
"
${
MHWDXORGCONF
}
"
]
;
then
echo
"'
${
MHWDXORGCONF
}
' symlink is invalid! Removing it..."
rm
"
${
MHWDXORGCONF
}
"
elif
[
-e
"
${
MHWDXORGCONF
}
"
]
;
then
echo
"xorg configuration symlink valid..."
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment