home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 682062ac9dc6f4c5ca5f42b96192310e5b809c26
parent d036adfbd70210be82ace19e53d9cab879aa58ad
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 24 Jan 2020 18:23:36 +0100

scripts: add up and some scripts 🏫

- up-redhat-vpn to connect to the vpn
- up-home-manage to update home-manager

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Apkgs/scripts/bin/up | 30++++++++++++++++++++++++++++++
Apkgs/scripts/bin/up-home-manager | 48++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/scripts/bin/up-redhat-vpn | 17+++++++++++++++++
3 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/pkgs/scripts/bin/up b/pkgs/scripts/bin/up @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# Author: Vincent Demeester <vincent@sbr.pm> +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# up is my main command I wanna run in the morning, it should try to be smart +DEFAULTS_ARGS="home-manager redhat-vpn" +ARGS=${@} + +[[ -z ${@} ]] && ARGS="${DEFAULTS_ARGS}" + +for script in ${ARGS}; do + command -v up-$script 2>/dev/null >/dev/null || { + echo up-$script is missing + } +done + +for script in ${ARGS}; do + up-$script +done diff --git a/pkgs/scripts/bin/up-home-manager b/pkgs/scripts/bin/up-home-manager @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# Author: Vincent Demeester <vincent@sbr.pm> +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# --- +# up-home-manager updates home-manager +update=no +pull=yes + +TARGETS=switch + +set -ue +while getopts "un" o; do + case "${o}" in + u) + update=yes + ;; + n) + pull=no + ;; + *) + echo "Invalid option"; exit 1; + ;; + esac +done +shift $((OPTIND-1)) + +cd $HOME/.config/nixpkgs/ +if [[ "$pull" == "yes" ]]; then + git pull --rebase --autostash +fi +if [[ "$update" == "yes" ]]; then + TARGETS="update $TARGETS" +fi + +make $TARGETS +cd - diff --git a/pkgs/scripts/bin/up-redhat-vpn b/pkgs/scripts/bin/up-redhat-vpn @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# -*- coding: utf-8 -*- +# Author: Vincent Demeester <vincent@sbr.pm> +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# --- +redhat-vpn