From b37101ba4fa0560920f9609cdbc44cf25c5ae6a3 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 7 Feb 2021 16:13:27 +0100 Subject: pkgs: Fix issues with non-existent dirs/files bin/pkgs: Ensure that initial directories for files and files to be used for package lists exist. --- bin/pkgs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/pkgs b/bin/pkgs index 0e7f49d..e8281b3 100755 --- a/bin/pkgs +++ b/bin/pkgs @@ -1,14 +1,14 @@ #!/usr/bin/env bash -set -euo pipefail +set -eu # source makepkg.conf to use PACKAGER . /etc/makepkg.conf # shellcheck source=/dev/null [ -f "${HOME}/.makepkg.conf" ] && . "${HOME}/.makepkg.conf" -package_dir_base="$HOME/packages/" -nvchecker_config="${HOME}/.config/nvchecker/nvchecker.ini" +package_dir_base="${HOME}/packages/" +nvchecker_config="${HOME}/.config/nvchecker/nvchecker.toml" repo="" package="" mode="" @@ -33,6 +33,8 @@ declare -A package_dirs=( ["extra"]="${package_dir_base}extra" ) +# TODO: check whether git and subversion are installed + create_tmp_packagelist() { local list_file="" list_file=$(basename "$1") @@ -43,6 +45,10 @@ add_package() { local name="$1" local tmp_file="" tmp_file=$(create_tmp_packagelist "${package_lists[$repo]}") + if [[ ! -f "${package_lists[$repo]}" ]]; then + echo "Adding initial package list: ${package_lists[$repo]}" + touch "${package_lists[$repo]}" + fi echo "Adding $package to list of $repo packages." echo "$name" | cat "${package_lists[$repo]}" - |uniq |sort > "$tmp_file" cat "$tmp_file" > "${package_lists[$repo]}" @@ -108,6 +114,7 @@ create_repo_dir() { else ( echo "Checking out $repo directory." + mkdir -pv "$(dirname "${package_dirs[$repo]}")" cd "$(dirname "${package_dirs[$repo]}")" svn checkout -N "${upstreams[$repo]}" \ "$(basename "${package_dirs[$repo]}")" -- cgit v1.2.3-70-g09d2