Skip to content

Instantly share code, notes, and snippets.

@syoh
Created May 5, 2020 18:59
Show Gist options
  • Save syoh/391eec8d1ea15d4934355bac38a681ba to your computer and use it in GitHub Desktop.
Save syoh/391eec8d1ea15d4934355bac38a681ba to your computer and use it in GitHub Desktop.
bootstrap script
#!/bin/bash
OSNAME=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)
USERNAME=$(echo $HOME | cut -d"/" -f3)
[[ $(echo $USERNAME | grep -c jovyan) != 0 ]] && ISJOVYAN=true || ISJOVYAN=false
[[ $(groups | grep -c sudo) != 0 ]] && ISSUDOER=true || ISSUDOER=false
[[ $WSL_DISTRO_NAME ]] && ISWSL=true || ISWSL=false
## [[ "$OSNAME" == "debian" ]] && ISDEBIAN=true || ISDEBIAN=false
## [[ "$OSNAME" == "ubuntu" ]] && ISUBUNTU=true || ISUBUNTU=false
echo "####"
echo "OSNAME : $OSNAME"
echo "USERNAME: $USERNAME"
echo "ISJOVYAN: $ISJOVYAN"
echo "ISSUDOER: $ISSUDOER"
echo "ISWSL : $ISWSL"
echo "####"
[ "$ISSUDOER" = true ] && \
echo Install general stuff like wget curl
[ "$ISSUDOER" = true ] && [ "$ISJOVYAN" = false ] && \
echo Install non-docker stuff like zathura
[ "$ISWSL" = true ] && \
echo Set WSL stuff like DISPLAY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment