2023-12-07 04:02:47 +03:00
|
|
|
# Fix when ethernet mistakenly detects 100 Mb instead of 1000 Mb.
|
2023-10-30 03:49:10 +03:00
|
|
|
# SPEED is one of 10/100/1000 etc.
|
2023-12-07 04:02:47 +03:00
|
|
|
# Usage: fix_ethernet_speed <DEVICE> <SPEED>
|
2023-12-07 01:44:42 +03:00
|
|
|
function fix_ethernet_speed() {
|
2023-12-05 21:50:45 +03:00
|
|
|
local device="${1}"
|
|
|
|
local speed="${2}"
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2023-12-05 21:50:45 +03:00
|
|
|
if [[ "${device}" = "" || "${speed}" = "" ]]; then
|
2023-12-07 04:02:47 +03:00
|
|
|
help fix_ethernet_speed
|
2023-12-05 21:50:45 +03:00
|
|
|
return 2
|
|
|
|
fi
|
2023-08-08 16:24:15 +03:00
|
|
|
|
2023-12-05 21:50:45 +03:00
|
|
|
ethtool -s "${device}" speed "${speed}"
|
2023-08-08 16:24:15 +03:00
|
|
|
}
|
|
|
|
|
2023-12-07 04:02:47 +03:00
|
|
|
# Fix nautilus after typing wrong sftp password.
|
2023-12-07 01:44:42 +03:00
|
|
|
function fix_files_sftp() {
|
2023-12-07 00:42:06 +03:00
|
|
|
secret-tool clear protocol sftp
|
|
|
|
}
|
2024-01-31 18:37:16 +03:00
|
|
|
|
|
|
|
# Delete lost Gradle lock files.
|
|
|
|
function fix_gradle_lock() {
|
2024-02-01 16:09:42 +03:00
|
|
|
cd "${HOME}/.gradle" && find -type f | grep \\.lock$ | xargs -- rm
|
2024-02-07 22:37:34 +03:00
|
|
|
cd -
|
2024-01-31 18:37:16 +03:00
|
|
|
}
|
2024-02-03 00:31:24 +03:00
|
|
|
|
|
|
|
# Fix Gnome's broken RDP ffs.
|
2024-02-03 03:59:52 +03:00
|
|
|
# Usage: fix_gnome_rdp <PASSWORD>
|
2024-02-03 00:31:24 +03:00
|
|
|
function fix_gnome_rdp() {
|
2024-02-03 03:59:52 +03:00
|
|
|
local user="${USERNAME}"
|
|
|
|
local password="${1}"
|
2024-02-03 00:31:24 +03:00
|
|
|
|
|
|
|
# Check params.
|
2024-02-03 03:59:52 +03:00
|
|
|
if [[ "${password}" = "" ]]; then
|
2024-02-03 00:31:24 +03:00
|
|
|
help fix_gnome_rdp
|
|
|
|
return 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Unlock keyring. PROTIP: Disable password for it in password manager.
|
|
|
|
pkill -9 -f gnome-keyring-daemon
|
|
|
|
echo -n "${user}" | gnome-keyring-daemon --unlock
|
|
|
|
|
|
|
|
# Generate keys.
|
|
|
|
cd /tmp
|
|
|
|
openssl genrsa -out rdp-tls.key 4096
|
|
|
|
openssl req -new -key rdp-tls.key -subj "/C=US" | openssl x509 -req -days 730 -signkey rdp-tls.key -out rdp-tls.crt
|
2024-02-03 03:59:52 +03:00
|
|
|
mkdir -p "${HOME}/.local/share/gnome-remote-desktop/"
|
|
|
|
mv rdp-tls.key rdp-tls.crt "${HOME}/.local/share/gnome-remote-desktop/"
|
2024-02-03 00:31:24 +03:00
|
|
|
|
|
|
|
# Configure RDP.
|
2024-02-03 03:59:52 +03:00
|
|
|
grdctl rdp set-tls-cert "${HOME}/.local/share/gnome-remote-desktop/rdp-tls.crt"
|
|
|
|
grdctl rdp set-tls-key "${HOME}/.local/share/gnome-remote-desktop/rdp-tls.key"
|
2024-02-03 00:31:24 +03:00
|
|
|
grdctl rdp set-credentials "${user}" "${password}"
|
|
|
|
grdctl rdp disable-view-only
|
|
|
|
|
|
|
|
# Start service.
|
|
|
|
grdctl rdp enable
|
|
|
|
systemctl --user start gnome-remote-desktop.service
|
|
|
|
|
|
|
|
# Show status.
|
|
|
|
grdctl status --show-credentials
|
|
|
|
systemctl --user status gnome-remote-desktop.service
|
|
|
|
|
2024-02-03 01:42:46 +03:00
|
|
|
# Show extra info.
|
|
|
|
_warn "You may need to manually restart Desktop sharing via Gnome Settings."
|
2024-02-03 00:31:24 +03:00
|
|
|
}
|