-
-
Save b23prodtm/b058b8b0efbd7e9c632dbcc7affe1754 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
if [ -z $(command -v wslvar) ]; then printf "%s\n" "Install package wslu please" ; sleep 2; exit 0; fi | |
username=$(wslvar USERNAME | awk '{ print tolower($0) }' ) | |
mkdir -p --parents "/mnt/c/users/$username/.ubuntu/" | |
cd "/mnt/c/users/$username/.ubuntu" | |
if [ ! -f /etc/apt/sources.list.d/microsoft-prod.list ]; then | |
sudo apt-key adv --fetch-keys https://packages.microsoft.com/keys/microsoft.asc | |
sudo apt update | |
fi | |
if [ ! -f /etc/apt/sources.list.d/wsl-transdebian.list ]; then | |
sudo wget -O /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg | |
sudo chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg | |
sudo cat << EOF > /etc/apt/sources.list.d/wsl-transdebian.list | |
deb https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main | |
deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main | |
EOF | |
sudo apt update | |
fi | |
if [ -z $(sudo apt install --yes systemd-genie > /dev/null) ]; then | |
if [ ! -f /etc/sudoers.d/$USER ]; then | |
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/genie" | sudo EDITOR="tee" visudo --fil> fi | |
fi | |
# CREATE BASH SCRIPT | |
# Save block of text in bash file | |
cat << EOF > "/mnt/c/users/$username/.ubuntu/02_start_desktop.sh" | |
# Define necessary environment variables | |
export DISPLAY="\$(cat /etc/resolv.conf | grep nameserver | awk '{ print \$2 }'):0.0" | |
export DESKTOP_SESSION="ubuntu" | |
export GDMSESSION="ubuntu" | |
export XDG_SESSION_DESKTOP="ubuntu" | |
export XDG_CURRENT_DESKTOP="ubuntu:GNOME" | |
export XDG_SESSION_TYPE="x11" | |
export XDG_BACKEND="x11" | |
export XDG_SESSION_CLASS="user" | |
export XDG_DATA_DIRS="/usr/local/share/:/usr/share/:/var/lib/snapd/desktop" | |
export XDG_CONFIG_DIRS="/etc/xdg" | |
export XDG_RUNTIME_DIR="\$HOME/xdg" | |
export XDG_CONFIG_HOME="\$HOME/.config" | |
export XDG_DATA_HOME="\$HOME/.local/share" | |
export XDG_CACHE_HOME="\$HOME/.cache" | |
export XDG_DESKTOP_DIR="\$HOME/Desktop" | |
export XDG_DOCUMENTS_DIR="\$HOME/Documents" | |
export XDG_DOWNLOAD_DIR="\$HOME/Downloads" | |
export XDG_MUSIC_DIR="\$HOME/Music" | |
export XDG_PICTURES_DIR="\$HOME/Pictures" | |
export XDG_PUBLICSHARE_DIR="\$HOME/Public" | |
export XDG_TEMPLATES_DIR="\$HOME/Templates" | |
export XDG_VIDEOS_DIR="\$HOME/Videos" | |
# Start desktop environment | |
gnome-session | |
EOF |
The Code is not working for me.
I get an Error because Failed to fetch https://wsl-translinux.arkane-systems.net/apt/InRelease Could not resolve 'wsl-translinux.arkane-systems.net' and
./wsl2-setup-desktop-gnome.sh: line 56: syntax error: unexpected end of file`. The secound one looks like a Problem with the visudo command.
Updated from scratch in gist with latest Arkane systems genie repository
The same error happens for me too: Failed to fetch https://wsl-translinux.arkane-systems.net/apt/InRelease Could not resolve 'wsl-translinux.arkane-systems.net' and ./wsl2-setup-desktop-gnome.sh: line 56: syntax error: unexpected end of file
.
Same:
Some index files failed to download. They have been ignored, or old ones used instead.
./wsl2-setup-desktop-gnome.sh: line 56: syntax error: unexpected end of file
Run script raised error:
The repository 'https://ppa.launchpadcontent.net/communitheme/ppa/ubuntu jammy Release' does not have a Release file.
How to share an USB mass storage here datailed for Ubuntu in WSL
E.g.
usbipd wsl attach -b 1-3 -d Ubuntu-Preview
will attach my USB mass storage device to the Ubuntu-Preview terminal sessionThere is a new graphical interface for usbip