Skip to content

Instantly share code, notes, and snippets.

@rajiteh
Last active February 4, 2023 01:18

Revisions

  1. rajiteh renamed this gist Feb 4, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. rajiteh revised this gist Feb 4, 2023. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,21 @@
    #!/bin/bash
    set -euo pipefail

    hlds_bin="/home/wineuser/.wine/drive_c/Counter-Strike/hlds.exe"
    download_location="/home/wineuser/.wine/drive_c"
    hlds_bin="${download_location}/Counter-Strike/hlds.exe"

    function log() {
    printf >&2 "%s:\t%s\n" "$(date)" "${@}"
    }

    if [[ -f "${hlds_bin}" ]]; then
    log "Game launcher discovered at ${hlds_bin}"
    log "HLDS discovered at ${hlds_bin}"
    else
    log "Game not found, downloading ... "
    log "HLDS not found, downloading ... "
    mkdir -p "${download_location}"
    dl_path="$(mktemp --suffix=.zip)"
    wget -O "${dl_path}" ${DOWNLOAD_URL}
    unzip "${dl_path}" -d "${download_location}"
    fi

    log "Launching ..."
  3. rajiteh created this gist Feb 3, 2023.
    17 changes: 17 additions & 0 deletions init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash
    set -euo pipefail

    hlds_bin="/home/wineuser/.wine/drive_c/Counter-Strike/hlds.exe"

    function log() {
    printf >&2 "%s:\t%s\n" "$(date)" "${@}"
    }
    if [[ -f "${hlds_bin}" ]]; then
    log "Game launcher discovered at ${hlds_bin}"
    else
    log "Game not found, downloading ... "
    fi

    log "Launching ..."

    exec wine cmd.exe /C "cd /D C:\Counter-Strike\ && hlds.exe -game cstrike -console +map aim_map"