From: Hugo Villeneuve Date: Thu, 19 Nov 2015 02:31:30 +0000 (-0500) Subject: Add Make target to list all installed packages X-Git-Url: http://gitweb.hugovil.com/?p=hvlinux.git;a=commitdiff_plain;h=ae7c467ebccf9587c942691eb34d963e7893134b Add Make target to list all installed packages --- diff --git a/Makefile b/Makefile index cd1e6e7..37a2336 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ # dep # list -> list installed packages and versions -.PHONY: get test +.PHONY: get test log RUN_MODE := $(shell . functions/version && check_hvlinux_version) @@ -25,6 +25,9 @@ endif ifeq ($(MAKECMDGOALS),test) STAGES := $(shell seq 0 5) endif +ifeq ($(MAKECMDGOALS),log) + STAGES := $(shell seq 2 5) +endif all: @for k in $(STAGES); do \ diff --git a/functions/main b/functions/main index 2801230..72205ec 100644 --- a/functions/main +++ b/functions/main @@ -176,6 +176,23 @@ check_for_root_user() fi } +init_installed_packages_log() +{ + export INSTALLED_PACKAGES_LOG_FILE=${LFS_LOG_DIR}/versions.log + + # Erase old file + echo "List of installed packages:" > ${INSTALLED_PACKAGES_LOG_FILE} + echo "" >> ${INSTALLED_PACKAGES_LOG_FILE} + + export LIST_INSTALLED_PACKAGES=1 +} + +init_installed_packages_log_append() +{ + export INSTALLED_PACKAGES_LOG_FILE=${LFS_LOG_DIR}/versions.log + export LIST_INSTALLED_PACKAGES=1 +} + # Extracting the version number from a complete package name. # Arg. #1: Complete package name with version (ex: firefox-3.5.5.source will output 3.5.5) get_pkg_ver() @@ -987,6 +1004,15 @@ ipkg() ;; esac + # Mode to only log that a package has been installed + if [ -n "${LIST_INSTALLED_PACKAGES}" ]; then + PACKAGE_LOG=${LFS_LOG_DIR}/versions.log + if [ -f ${PACKAGE_DONE} ]; then + echo "${PACKAGE}" >> ${INSTALLED_PACKAGES_LOG_FILE} + fi + return $EXIT_SUCCESS + fi + # Checking if package was previously successfully installed if [ -f ${PACKAGE_DONE} ]; then return $EXIT_SUCCESS diff --git a/stage2/Makefile b/stage2/Makefile index b5595fc..2f52a67 100644 --- a/stage2/Makefile +++ b/stage2/Makefile @@ -7,7 +7,7 @@ # dep # list -> list installed packages and versions -.PHONY: get test +.PHONY: get test log all: @./hv-install-1 @@ -16,6 +16,10 @@ all: get: @./packages-update +# List all installed packages +log: + @./hv-install-1 log + # Test integrity of packages test: @./packages-update test diff --git a/stage2/hv-install-1 b/stage2/hv-install-1 index db8b333..26872a2 100755 --- a/stage2/hv-install-1 +++ b/stage2/hv-install-1 @@ -6,7 +6,13 @@ source /etc/profile check_for_root_user init_log_file -rscr mult "Performing pre-install" pre-install +if [ ${#} -eq 1 -a x"${1}" = x"log" ]; then + init_installed_packages_log +fi + +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + rscr mult "Performing pre-install" pre-install +fi ipkg -m noac -l "kernel-headers" -s "kernel-headers" ${KERNEL} ipkg -m acnb -j -l "${PERL}-pass1" ${PERL} @@ -14,9 +20,11 @@ ipkg -m noac ${MANPAGES} ipkg ${GLIBC} ipkg -m noac -s tzdata -c ${TZDATA} -rscr once "Adjusting toolchain" toolchain-adjust -rscr once "Creating temporary C++ toolchain hack" toolchain-hack-cpp-add -rscr mult "Testing toolchain" toolchain-test +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + rscr once "Adjusting toolchain" toolchain-adjust + rscr once "Creating temporary C++ toolchain hack" toolchain-hack-cpp-add + rscr mult "Testing toolchain" toolchain-test +fi export CC="gcc -isystem /usr/include" export CXX="g++ -isystem /usr/include" @@ -35,8 +43,11 @@ unset LDFLAGS ipkg -m acnb ${ZLIB} ipkg ${BINUTILS} ipkg ${GCC} -rscr once "Deleting temporary C++ toolchain hack" toolchain-hack-cpp-remove -rscr mult "Testing toolchain" toolchain-test +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + rscr once "Deleting temporary C++ toolchain hack" toolchain-hack-cpp-remove + rscr mult "Testing toolchain" toolchain-test +fi + ipkg ${SED} "--bindir=/bin" ipkg ${LIBFFI} ipkg ${PYTHON} "--enable-shared" diff --git a/stage2/hv-install-2 b/stage2/hv-install-2 index 531d57e..6f0fb78 100755 --- a/stage2/hv-install-2 +++ b/stage2/hv-install-2 @@ -4,6 +4,10 @@ source ../functions/main init_log_file +if [ ${#} -eq 1 -a x"${1}" = x"log" ]; then + init_installed_packages_log_append +fi + ipkg ${BC} "--with-readline" ipkg ${GDBM} "--enable-libgdbm-compat" ipkg ${INETUTILS} "\ @@ -78,15 +82,17 @@ ipkg -m noac -l "kernel" -s "kernel" ${KERNEL} rscr once "Installing bootscripts" install-bootscripts rscr once "Creating default config files" create-config-files -rscr mult "Compressing man pages" compressdoc -#rscr mult "Stripping" stripping +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + rscr mult "Compressing man pages" compressdoc + #rscr mult "Stripping" stripping -rscr once "Setting root password:\n" create-root-password + rscr once "Setting root password:\n" create-root-password -rscr mult "Performing post-install" post-install -ldconfig + rscr mult "Performing post-install" post-install + ldconfig -write_completed_stage -display_stage_build_stats + write_completed_stage + display_stage_build_stats -exec /bin/bash --login + exec /bin/bash --login +fi diff --git a/stage3/Makefile b/stage3/Makefile index b5595fc..2f52a67 100644 --- a/stage3/Makefile +++ b/stage3/Makefile @@ -7,7 +7,7 @@ # dep # list -> list installed packages and versions -.PHONY: get test +.PHONY: get test log all: @./hv-install-1 @@ -16,6 +16,10 @@ all: get: @./packages-update +# List all installed packages +log: + @./hv-install-1 log + # Test integrity of packages test: @./packages-update test diff --git a/stage3/hv-install-1 b/stage3/hv-install-1 index 9e3eae8..1990076 100755 --- a/stage3/hv-install-1 +++ b/stage3/hv-install-1 @@ -6,6 +6,10 @@ source /etc/profile check_for_root_user init_log_file +if [ ${#} -eq 1 -a x"${1}" = x"log" ]; then + init_installed_packages_log +fi + ipkg -m noac ${BASHCOMPLETION} ipkg ${WHICH} ipkg -m acnb ${REISERFSPROGS} "--sbindir=/sbin" @@ -250,7 +254,9 @@ if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; the fi fi -write_completed_stage -display_stage_build_stats +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + write_completed_stage + display_stage_build_stats +fi exit $? diff --git a/stage4/Makefile b/stage4/Makefile index 84ec796..1b7d173 100644 --- a/stage4/Makefile +++ b/stage4/Makefile @@ -7,7 +7,7 @@ # dep # list -> list installed packages and versions -.PHONY: get test versions +.PHONY: get test versions log all: @./hv-install-1 @@ -16,6 +16,10 @@ all: get: @./packages-update +# List all installed packages +log: + @./hv-install-1 log + # Fetch packages version files versions: @./versions-update diff --git a/stage4/hv-install-1 b/stage4/hv-install-1 index 721948d..fecfd30 100755 --- a/stage4/hv-install-1 +++ b/stage4/hv-install-1 @@ -6,6 +6,10 @@ source /etc/profile check_for_root_user init_log_file +if [ ${#} -eq 1 -a x"${1}" = x"log" ]; then + init_installed_packages_log +fi + VERSIONS_DIR="${SCRDIR}/versions" export XORG_CONFIG="\ @@ -114,7 +118,9 @@ ipkg -m acnb ${XDG_UTILS} "--mandir=/usr/share/man" ipkg -m acnb ${WINDOWMAKER} "--with-gnustepdir=/usr/share/GNUstep" ipkg ${WINDOWMAKER_EXTRA} -write_completed_stage -display_stage_build_stats +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + write_completed_stage + display_stage_build_stats +fi exit $? diff --git a/stage5/Makefile b/stage5/Makefile index b5595fc..2f52a67 100644 --- a/stage5/Makefile +++ b/stage5/Makefile @@ -7,7 +7,7 @@ # dep # list -> list installed packages and versions -.PHONY: get test +.PHONY: get test log all: @./hv-install-1 @@ -16,6 +16,10 @@ all: get: @./packages-update +# List all installed packages +log: + @./hv-install-1 log + # Test integrity of packages test: @./packages-update test diff --git a/stage5/hv-install-1 b/stage5/hv-install-1 index 9677c03..bffcba4 100755 --- a/stage5/hv-install-1 +++ b/stage5/hv-install-1 @@ -6,6 +6,10 @@ source /etc/profile check_for_root_user init_log_file +if [ ${#} -eq 1 -a x"${1}" = x"log" ]; then + init_installed_packages_log +fi + ipkg ${HELP2MAN} ipkg ${GSL} @@ -333,9 +337,10 @@ ipkg -m noac ${STELLARIUM} ipkg -m noac ${I2C_TOOLS} ipkg -m noac ${HDPARM} -rscr mult "Performing post-install" post-install - -write_completed_stage -display_stage_build_stats +if [ -z "${LIST_INSTALLED_PACKAGES}" ]; then + rscr mult "Performing post-install" post-install + write_completed_stage + display_stage_build_stats +fi exit $?