nullpo-head / wsl-distrod

Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
MIT License
1.9k stars 90 forks source link

Start distrod in the os ~/home instead of under /mnt/c/ #44

Open httpete opened 2 years ago

httpete commented 2 years ago

Describe the bug

When start the distro, the home dir is under /mnt/c. I always have to cd ~, and then source ~/.bashrc to get what I want. How can set this up so it's always in the ~ ?

Steps to reproduce

When start the distro, the home dir is under /mnt/c. I always have to cd ~, and then source ~/.bashrc to get what I want. How can set this up so it's always in the ~ ?

Expected behavior

No response

Windows version

V21H2

Linux kernel version

Linux HB3H6D3 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Distro

Centos8

How did you install that distro?

Installed by Distrod wizard

Logs

.

additional comment

No response

httpete commented 2 years ago

I think the best answer is to drop a ~/.profile file with the following contents, and then go into your Windows Terminal settings and set the starting directory to /home/


# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi