aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2021-02-07 16:13:27 +0100
committerDavid Runge <dave@sleepmap.de>2021-02-07 16:13:27 +0100
commitb37101ba4fa0560920f9609cdbc44cf25c5ae6a3 (patch)
tree4c6aa423b14de44cdffab2b6bbbe1eb0be97f3ce
parentf293453d9b0b1d1e090bc294966b358d8273facf (diff)
downloaddotfiles-b37101ba4fa0560920f9609cdbc44cf25c5ae6a3.tar.gz
dotfiles-b37101ba4fa0560920f9609cdbc44cf25c5ae6a3.tar.bz2
dotfiles-b37101ba4fa0560920f9609cdbc44cf25c5ae6a3.tar.xz
dotfiles-b37101ba4fa0560920f9609cdbc44cf25c5ae6a3.zip
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.
-rwxr-xr-xbin/pkgs13
1 files 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]}")"