Skip to content

Instantly share code, notes, and snippets.

@L1ghtmann
Last active November 29, 2025 15:34
Show Gist options
  • Select an option

  • Save L1ghtmann/d8359abfe5ec08ad377049b585851f24 to your computer and use it in GitHub Desktop.

Select an option

Save L1ghtmann/d8359abfe5ec08ad377049b585851f24 to your computer and use it in GitHub Desktop.
setup WSL
#!/bin/bash
if ! [[ -x $(command -v apt) ]]; then
echo "Only for Debian-based distros"
exit 0
fi
codename="$(grep 'PRETTY_NAME' /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p')"
if ! [[ -z $(cat /etc/apt/sources.list | grep "$codename") ]]; then
sudo sed -i "s/$codename/testing/g" /etc/apt/sources.list
fi
cat << 'EOF' >> ~/.profile
PATH=$PATH:$HOME/.local/bin
export IP=$(cat $HOME/.theosrc | sed -e '/#/d' | cut -d= -f2 2> /dev/null)
export THEOS=~/theos
export theos=$THEOS/bin/nic.pl
export PROMPT_DIRTRIM=1
alias log=idevicesyslog
alias diff=colordiff
EOF
cat << 'EOF' >> ~/.bashrc
update() {
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt autoclean
sudo apt clean
}
refresh-submodules() {
git submodule deinit -f --all
git submodule update --init
}
plutil() {
bash -c "$(printf %q "/mnt/c/Program Files (x86)/Common Files/Apple/Apple Application Support/plutil.exe")"
}
EOF
cat << 'EOF' > ~/.nicrc
package_prefix = "me.lightmann"
username = "Lightmann "
EOF
cat << 'EOF' > ~/.theosrc
THEOS_DEVICE_IP=
#THEOS_DEVICE_IP=
#THEOS_DEVICE_IP=
EOF
sudo apt update
sudo apt full-upgrade -y
sudo apt install curl ripgrep ffmpeg vim git gnupg2 python3 python3-pip python3-dev cmake autoconf automake libtool libheif-examples libjpeg-dev poppler-utils colordiff diffpdf ghostscript perltidy -y
git config --global core.editor "vim"
python3 -m pip config set global.break-system-packages true
python3 -m pip install --upgrade pip
python3 -m pip install pip-review pip-autoremove pip_search img2pdf pdf2docx pdf2image qrcode sphinx ruff yamllint
if [[ -z "$(ls ~/.ssh/*.pub)" ]]; then
echo "Please configure an SSH key for git before proceeding."; exit 0
fi
if [[ -z $THEOS || ! -d $HOME/theos ]]; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/theos/theos/master/bin/install-theos)"
fi
pushd ~/theos > /dev/null
if [[ -z $(git remote -v | grep Lightmann) ]]; then
git remote rename origin upstream
git remote add origin git@github.com:L1ghtmann/theos.git
git fetch -a
git pull origin master
bash bin/update-theos
fi
popd > /dev/null
if ! [[ -d $HOME/dragon ]]; then
git clone --recursive git@github.com:L1ghtmann/dragon
cd dragon
bash development_install.sh
bash bin/dragon
cd ../
fi
if ! [[ -x $(command -v rvm) ]]; then
gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
~/.rvm/bin/rvm install 3.1.0
curl -L https://www.openssl.org/source/openssl-1.1.1q.tar.gz -o os.tar.gz
tar -xf os.tar.gz && rm os.tar.gz
cd openssl*
./config --prefix=/usr/local/openssl-1.1.1q --openssldir=/usr/local/openssl-1.1.1q -Wno-error=implicit-function-declaration
sudo make -j$(nproc) install_sw || exit 1
cd ../
rm -rf openssl*
~/.rvm/bin/rvm install -E CPPFLAGS=-Wno-incompatible-pointer-types --with-openssl-dir=/usr/local/openssl-1.1.1q 2.7.0
~/.rvm/bin/rvm alias create default ruby-3.1.0
~/.rvm/rubies/ruby-3.1.0/bin/gem install jekyll bundler
fi
# rustup
# go
# node
if ! [[ -f /usr/local/bin/plistutil ]]; then
git clone --depth=1 https://github.com/libimobiledevice/libplist lp
cd lp
./autogen.sh --without-cython --enable-static --disable-shared
sudo make -j install || exit 1
cd ../ && sudo rm -rf lp
fi
if ! [[ -f /usr/local/bin/jpegoptim ]]; then
git clone --depth=1 https://github.com/tjko/jpegoptim jo
cd jo
./configure
make -j || exit 1
make -j strip || exit 1
sudo make -j install || exit 1
cd ../ && rm -rf jo
fi
echo "All good to go!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment