From 0bf823d72e748f214c771e9b1ccc82b46c30b309 Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Thu, 10 Aug 2023 14:37:56 +0200 Subject: [PATCH] added exclude packages script --- .config/picom.conf | 2 +- .setup/config/exclude_from_update.sh | 40 ++++++++++++++++++++++ .setup/packages/exclude_from_updating.list | 2 ++ .zshrc | 9 +++-- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100755 .setup/config/exclude_from_update.sh create mode 100644 .setup/packages/exclude_from_updating.list diff --git a/.config/picom.conf b/.config/picom.conf index f727a64..ede6123 120000 --- a/.config/picom.conf +++ b/.config/picom.conf @@ -1 +1 @@ -picom.conf##class.arch_laptop \ No newline at end of file +picom.conf##class.arch_desktop \ No newline at end of file diff --git a/.setup/config/exclude_from_update.sh b/.setup/config/exclude_from_update.sh new file mode 100755 index 0000000..5ba9a20 --- /dev/null +++ b/.setup/config/exclude_from_update.sh @@ -0,0 +1,40 @@ +# read list of packages to exclude from update +exclude_list_file=~/.setup/packages/exclude_from_updating.list +exclude_list=$(cat $exclude_list_file) + +pacman_config_file=/etc/pacman.conf + +# get current IngorePkg line from pacman.conf +# line may have # at the beginning +old_ignore_line=$(grep -P "^#?IgnorePkg" $pacman_config_file) +echo old_ignore_line: $old_ignore_line + +# split line at = and take second part +old_packages_line=$(echo $old_ignore_line | cut -d= -f2) +echo old_packages_line: $old_packages_line + +# extract list of packages from line, separated by spaces +old_ignore_packages=$(echo $old_packages_line| tr -s ' ' '\n') +echo old_packages: $old_packages + +# add packages to ignore line, if not already there +new_ignore_packages=$old_ignore_packages +for package in $exclude_list; do + if [[ ! $old_ignore_packages =~ $package ]]; then + new_ignore_packages="$new_ignore_packages $package" + fi +done + +# join packages with spaces +new_ignore_packages_line=$(echo $new_ignore_packages | tr '\n' ' ') +echo new_ignore_packages_line: $new_ignore_packages_line + +# add IgnorePkg= to beginning of line +new_ignore_line="IgnorePkg = $new_ignore_packages_line" +echo new_ignore_line: $new_ignore_line + +# replace old IgnorePkg line with new one +echo "updating pacman.conf" +sudo sed -i "s/$old_ignore_line/$new_ignore_line/" $pacman_config_file + +echo "done" diff --git a/.setup/packages/exclude_from_updating.list b/.setup/packages/exclude_from_updating.list new file mode 100644 index 0000000..21e69bb --- /dev/null +++ b/.setup/packages/exclude_from_updating.list @@ -0,0 +1,2 @@ +cuda +cudnn diff --git a/.zshrc b/.zshrc index 53ec630..7cd95b8 100644 --- a/.zshrc +++ b/.zshrc @@ -32,9 +32,6 @@ if [ -d $HOME/.local/bin ] ; then PATH="$HOME/.local/bin:$PATH" fi -# add the custom functions from the .custom_functions file -custom_func_dir=$HOME/.scripts -for f in $custom_func_dir/*; do source $f; done # key bindings # create a zkbd compatible hash; @@ -151,3 +148,9 @@ bindkey '5C' forward-word bindkey '^[[3~' delete-char powerline-config tmux setup + +alias vim=nvim + +# add the custom functions from the .custom_functions file +custom_func_dir=$HOME/.scripts +for f in $custom_func_dir/*; do source $f; done