From da81b018fbbe5cf7a689dd0bf9ade48bd5f8fc0f Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 22 Jul 2023 16:19:31 +0800 Subject: [PATCH] support for nixos --- .update.sh | 2 +- install.sh | 2 +- scripts/dogo | 2 +- scripts/doll | 2 +- scripts/pbin | 2 +- scripts/riot | 2 +- tools/alpine.sh | 2 +- tools/append_zsh_hist.sh | 2 +- tools/common.sh | 2 +- tools/frigg-client.sh | 4 ++-- tools/get.dotfiles.cn | 2 +- tools/macos.sh | 2 +- tools/msys2.sh | 2 +- tools/sagent.sh | 13 ++++--------- tools/test-getopts.sh | 2 +- tools/to-install.sh | 2 +- tools/ubuntu.sh | 2 +- 17 files changed, 21 insertions(+), 26 deletions(-) diff --git a/.update.sh b/.update.sh index a06f8dc..1baa6c6 100644 --- a/.update.sh +++ b/.update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) THIS_FILE=$(basename "${BASH_SOURCE}") diff --git a/install.sh b/install.sh index 130f87f..b58d7f7 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/tools/common.sh" diff --git a/scripts/dogo b/scripts/dogo index 6c8f438..7abd989 100755 --- a/scripts/dogo +++ b/scripts/dogo @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" diff --git a/scripts/doll b/scripts/doll index 4c18839..6da3a6d 100755 --- a/scripts/doll +++ b/scripts/doll @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" diff --git a/scripts/pbin b/scripts/pbin index 3d410fb..c8929e2 100755 --- a/scripts/pbin +++ b/scripts/pbin @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" diff --git a/scripts/riot b/scripts/riot index bcca505..9bf3816 100755 --- a/scripts/riot +++ b/scripts/riot @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # connect to iot services THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/../tools/common.sh" diff --git a/tools/alpine.sh b/tools/alpine.sh index 1bf3688..d8b048f 100755 --- a/tools/alpine.sh +++ b/tools/alpine.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/common.sh" diff --git a/tools/append_zsh_hist.sh b/tools/append_zsh_hist.sh index fafac96..6ebd174 100755 --- a/tools/append_zsh_hist.sh +++ b/tools/append_zsh_hist.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/common.sh" diff --git a/tools/common.sh b/tools/common.sh index 4cc6c6b..0023c82 100755 --- a/tools/common.sh +++ b/tools/common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR_COMMON_SH=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) export DOTFILES=$( cd "$THIS_DIR_COMMON_SH/.." && pwd ) diff --git a/tools/frigg-client.sh b/tools/frigg-client.sh index abefcbc..cb68efd 100755 --- a/tools/frigg-client.sh +++ b/tools/frigg-client.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) @@ -162,4 +162,4 @@ router() esac } -router "${GOT_OPTS[@]}" \ No newline at end of file +router "${GOT_OPTS[@]}" diff --git a/tools/get.dotfiles.cn b/tools/get.dotfiles.cn index ac2166b..b1c0eb4 100644 --- a/tools/get.dotfiles.cn +++ b/tools/get.dotfiles.cn @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e ARG="" GOT_OPTS=() diff --git a/tools/macos.sh b/tools/macos.sh index 255e4f1..9c7aa9d 100755 --- a/tools/macos.sh +++ b/tools/macos.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/common.sh" diff --git a/tools/msys2.sh b/tools/msys2.sh index 7f230b6..1c36ee8 100755 --- a/tools/msys2.sh +++ b/tools/msys2.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/common.sh" diff --git a/tools/sagent.sh b/tools/sagent.sh index 24e5024..aebf317 100755 --- a/tools/sagent.sh +++ b/tools/sagent.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) export DFS_COLOR=1 @@ -7,7 +7,7 @@ source "$THIS_DIR/common.sh" find_so_file() { - local SO_PATHS=( "/usr/lib64/opensc-pkcs11.so" "/usr/local/lib/opensc-pkcs11.so" ) + local SO_PATHS=( "/usr/lib64/opensc-pkcs11.so" "/usr/local/lib/opensc-pkcs11.so" "/run/current-system/sw/lib/opensc-pkcs11.so" ) local SO_FILE for SO_FILE in ${SO_PATHS[*]}; do if [[ -f "$SO_FILE" ]]; then @@ -19,12 +19,7 @@ find_so_file() create_agent() { - local SO_FILE=$(find_so_file) - if [[ -n "$SO_FILE" ]]; then - fmt_note "opensc-pkcs11.so found" - SO_FILE="-P $SO_FILE" - fi - ssh-agent $SO_FILE + ssh-agent -P "/usr/lib64/*,/usr/local/lib/*,/nix/store/*" } kill_agent() @@ -106,4 +101,4 @@ route() esac } -route "$@" \ No newline at end of file +route "$@" diff --git a/tools/test-getopts.sh b/tools/test-getopts.sh index 9e14e47..a6e1956 100755 --- a/tools/test-getopts.sh +++ b/tools/test-getopts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex OPTS='-a -bcl --color --arg1=1 --arg2 2 " 1 2" yes' TARGET_OPTS='-a -b -c --arg1 1 --arg2 2 1 2 yes' diff --git a/tools/to-install.sh b/tools/to-install.sh index 363cea7..bfb1feb 100755 --- a/tools/to-install.sh +++ b/tools/to-install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash declare -A INSTALL_COMMANDS INSTALL_COMMANDS=(\ diff --git a/tools/ubuntu.sh b/tools/ubuntu.sh index 4fcd6f0..8f7e611 100755 --- a/tools/ubuntu.sh +++ b/tools/ubuntu.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) source "$THIS_DIR/common.sh"