#!/usr/bin/env bash set -x # KMonad is an advanced tool that lets you infinitely customize and extend the functionalities # of almost any keyboard. For a detailed list of features, see here # Include the script create functions split into a separate file. source ./020_kmonad-conf_print.sh DEST=${1:-/etc/skel} GITHUB_USER=kmonad PROJECT=kmonad API_URL=https://api.github.com/repos/${USER}/${PROJECT}/releases/latest # RELEASE=$(curl -s ${API_URL} | grep tarball_url | cut -d '"' -f 4 | awk -F "/" {'print $8'}) RELEASE=$(lastversion ${GITHUB_USER}/${PROJECT}) SDK_URL=https://github.com/${USER}/${PROJECT}/releases/download/${RELEASE} RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom" # xdg-open ${RSS_FEED} echo ${RSS_FEED} # make a containing directory BUILD_HOME="/var/tmp/${PROJECT}-${RELEASE}" mkdir -p "${BUILD_HOME}" echo "git clone --depth 1 https://github.com/${GITHUB_USER}/${PROJECT} /var/tmp/${PROJECT}-${RELEASE}" git clone --depth 1 https://github.com/${GITHUB_USER}/${PROJECT} "${BUILD_HOME}" cd "${BUILD_HOME}" || exit cat </tmp/temp && mv /tmp/temp ${DEST_FILE} # sed -E -e '/^(defsrc/,/^)/ { s/(.*)/\1'"$DEFSRC"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} # Gnerate the semply config: https://stevep99.github.io/seniply/ # SEMPLY_BUILD_HOME=/var/tmp/semply-kmonad-git # mkdir -p "${BUILD_HOME}" # git clone --depth 1 https://github.com/semplify/semply_kmonad ${SEMPLY_BUILD_HOME} DEST_FILE="${DEST}/.config/kmonad/colemak-dh-seniply-split.kbd" echo "DEST_FILE ${DEST_FILE}" echo ${DEST_FILE} wget -c -O "${DEST_FILE}" https://raw.githubusercontent.com/stevep99/seniply/master/downloads/kmonad/colemak-dh-seniply-split.kbd # sed -E -e '/^(defcfg/,/^)/ { s/(.*)/\1'"$DEFCFG"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} # sed -E -e '/^(defsrc/,/^)/ { s/(.*)/\1'"$DEFSRC"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} DEST_FILE="${DEST}/.config/kmonad/colemak-dh-seniply-wide.kbd" echo ${DEST_FILE} echo "DEST_FILE ${DEST_FILE}" wget -c -O "${DEST_FILE}" https://raw.githubusercontent.com/stevep99/seniply/master/downloads/kmonad/colemak-dh-seniply-wide.kbd DEST_FILE="colemak-dh-seniply-wide.kbd" # sed -E -e '/^(defcfg/,/^)/ { s/(.*)/\1'"$DEFCFG"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} # sed -E -e '/^(defsrc/,/^)/ { s/(.*)/\1'"$DEFSRC"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} # create a config for the official colemak mod dh # See: https://raw.githubusercontent.com/ColemakMods/mod-dh/master/kmonad/colemak-dh-extend-iso.kbd KMONAD_HOME="${DEST}/.config/kmonad" DEST_FILE="${DEST}/.config/kmonad/colemak-dh-extend-iso.kbd" echo "DEST_FILE ${DEST_FILE}" FILE="${DEST}/.config/kmonad/colemak-dh-extend-iso.kbd" echo "DEST ${DEST}" # wget -c -O ${DEST_FILE} https://raw.githubusercontent.com/ColemakMods/mod-dh/master/kmonad/colemak-dh-extend-iso.kbd # sed -E -e '/^(defcfg/,/^)/ { s/(.*)/\1'"$DEFCFG"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} # sed -E -e '/^(defsrc/,/^)/ { s/(.*)/\1'"$DEFSRC"'/ }' ${DEST_FILE} >/tmp/temp && mv /tmp/temp ${DEST_FILE} conf_print_dell_d830_template_header | tee ${DEST_FILE} conf_print_dell_d830_template_defcfg | tee -a ${DEST_FILE} conf_print_dell_d830_template_defsrc | tee -a ${DEST_FILE} conf_print_dell_d830_template_defalias_extend | tee -a ${DEST_FILE} conf_print_dell_d830_template_defalias | tee -a ${DEST_FILE} conf_print_dell_d830_template_deflayer_querty | tee -a ${DEST_FILE} conf_print_dell_d830_template_deflayer_colemak_dh | tee -a ${DEST_FILE} conf_print_dell_d830_template_deflayer_colemak_dhk | tee -a ${DEST_FILE} conf_print_dell_d830_template_deflayer_extend | tee -a ${DEST_FILE} conf_print_dell_d830_template_deflayer_empty | tee -a ${DEST_FILE} # set the default keymap DEFAULT_KEYMAP="colemak-dh-seniply-split.kbd" DEFAULT_KEYMAP="colemak-dh-seniply-wide.kbd" DEFAULT_KEYMAP="miryoku.kbd" DEFAULT_KEYMAP="colemak-dh-extend-iso.kbd" sudo ln -sf ${DEST}/.config/kmonad/${DEFAULT_KEYMAP} ${DEST}/.config/kmonad/config.kbd # copy templates to the home config dir. sudo -u ${USER} cp -a keymap ${DEST}/.config/kmonad/ # This loads the user keymap on zsh start cat <<-EOF | tee ${HOME}/.zshrc.d/008_kmonad.zsh if [[ -f "${HOME}/.config/config.kbd" ]]; then /usr/local/bin/kmonad "${HOME}/.config/kmonad/config.kbd" fi EOF # Build the Docker image with alpine/haskell which will contain the binary. # if [ ! docker info ] >/dev/null 2>&1; then # echo "This script uses docker, and it isn't running - please start docker and try again!" # exit 1 # else # docker build -t kmonad-builder . # # Spin up an ephemeral Docker container from the built image, to just copy the # # built binary to the host's current directory bind-mounted inside the # # container at /host/. # docker run --rm -it -v ${PWD}:/host/ kmonad-builder bash -c "cp -vp /root/.local/bin/kmonad /host/" # # # Clean up build image, since it is no longer needed. # # docker rmi kmonad-builder # fi bash ${BUILD_HOME}/checkinstall_it.sh