#!/bin/bash

echo "Please use RoRConfig to configure parameters of game"

if [ ! -e ~/.rigsofrods ]; then
  unzip /usr/share/rigsofrods/resources/skeleton.zip -d ~/.rigsofrods/
  # Can't ship with game: https://github.com/RigsOfRods/rigs-of-rods/issues/542
  /usr/share/autodl/AutoDL.py /usr/share/rigsofrods/rigsofrods-data-pack.autodownload_rc \
    && unzip ~/.rigsofrods/packs/pack_highquality04.zip -d ~/.rigsofrods/packs \
    && rm -f ~/.rigsofrods/packs/pack_highquality04.zip
  RoRConfig
fi

# cd required to read plugins.cfg in current directory! See https://github.com/RigsOfRods/rigs-of-rods/issues/541
cd /usr/libexec/rigsofrods
exec ./RoR "$@"
