#!/usr/bin/env bash file=/etc/yum.repos.d/mariadb.repo install_cmd='yum install MariaDB-server' gpgkey=https://downloads.mariadb.com/MariaDB/yum/RPM-GPG-KEY-MariaDB err() { msg=$1 shift printf "[ERROR] $msg\n" "$@" >&2 exit 1 } for d in "$PWD" "${0%/*}"; do if [[ -d $d/repodata ]] ; then dir=$d if ! [[ $dir = /* ]] ; then dir=$PWD/$dir fi break fi done if ! [[ $dir ]] ; then err 'Could not find a "repodata" directory. Please change to the top level directory of the unpacked archive. and re-run this script.' fi if [[ -e $file ]] ; then err 'File "%s" already exists. Rename it and re-run this script, or manually create a new .repo file.' "$file" fi if ! cat > "$file" <