Last active
November 24, 2025 07:04
-
-
Save danawesome/22deef69afdd7689d9f604a9808260b1 to your computer and use it in GitHub Desktop.
Zorin OS 17 Post Install custom installs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # APT Install of net-tools, MS VSCode (and dependencies), then reboot. | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo 'This script must be run with root privileges' >&2 | |
| exit 1 | |
| fi | |
| apt update && apt upgrade -y | |
| if [ -f /var/run/reboot-required ]; then | |
| echo "A reboot is required in order to proceed with the install." >&2 | |
| echo "Please reboot and re-run this script to finish the install." >&2 | |
| exit 1 | |
| fi | |
| echo "Add net-tools, software-properties-common, apt-transport-https, wget, code" | |
| REQUIRED_PKG="net-tools" | |
| PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $REQUIRED_PKG|grep "install ok installed") | |
| echo Checking for $REQUIRED_PKG: $PKG_OK | |
| if [ "" = "$PKG_OK" ]; then | |
| echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG." | |
| apt -y install $REQUIRED_PKG | |
| fi | |
| echo "Install the dependencies for VSCode" | |
| apt -y install software-properties-common apt-transport-https wget | |
| echo "Import the Microsoft GPG key" | |
| wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add - | |
| echo "Add VSCode package repo" | |
| add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | |
| echo "Install VSCode (code)" | |
| apt install code | |
| apt install -y samba-common-bin | |
| apt autoremove | |
| reboot_maybe () | |
| { | |
| local PS3='Confirm system reboot [y]/n: ' | |
| local TMOUT=10 | |
| local do_reboot=true | |
| while true; do | |
| if ! read -p "$PS3"; then | |
| # timeout | |
| break | |
| fi | |
| case $REPLY in | |
| [yY]*) | |
| # default case | |
| break ;; | |
| [nN]*) | |
| do_reboot=false | |
| break ;; | |
| *) | |
| echo 'Sorry, try again' >&2 | |
| esac | |
| done | |
| if "$do_reboot"; then | |
| echo 'Rebooting...' | |
| systemctl reboot now | |
| else | |
| echo 'Will not reboot' | |
| fi | |
| } | |
| reboot_maybe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment