From d928c03b1199d828b534dcfc28ffd92426088d5b Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Sat, 31 Aug 2019 13:32:01 -0400 Subject: [PATCH] Refactor package install script --- Makefile | 4 ++-- install_pkgs.sh | 3 --- list | 11 +++++++++++ pkg-deb-install => pkgs-install | 0 pkg-deb-purge => pkgs-purge | 0 5 files changed, 13 insertions(+), 5 deletions(-) delete mode 100755 install_pkgs.sh create mode 100755 list rename pkg-deb-install => pkgs-install (100%) rename pkg-deb-purge => pkgs-purge (100%) diff --git a/Makefile b/Makefile index 70a93f0..c029724 100644 --- a/Makefile +++ b/Makefile @@ -15,5 +15,5 @@ install_home: @cp home/.tmux.conf $(HOME)/ @cp home/.xbindkeysrc $(HOME)/ -install_pkgs: install_pkgs.sh pkg-deb-install - ./install_pkgs.sh +install_pkgs: list pkgs-install + sudo apt install $(shell ./list pkgs-install) diff --git a/install_pkgs.sh b/install_pkgs.sh deleted file mode 100755 index 573217f..0000000 --- a/install_pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh - -sudo apt install $(awk '! /^\#/ && ! /^$/ {pkgs[$1]++} END {for (p in pkgs) {printf "%s%s", sep, p; sep = " "}}' pkg-deb-install) diff --git a/list b/list new file mode 100755 index 0000000..acfdde7 --- /dev/null +++ b/list @@ -0,0 +1,11 @@ +#! /usr/bin/awk -f + +! /^\#/ && ! /^$/ { + xs[$1]++ +} + +END { + for (x in xs) { + printf("%s%s", sep, x, sep = " ") + } +} diff --git a/pkg-deb-install b/pkgs-install similarity index 100% rename from pkg-deb-install rename to pkgs-install diff --git a/pkg-deb-purge b/pkgs-purge similarity index 100% rename from pkg-deb-purge rename to pkgs-purge -- 2.20.1