Add Make target to list all installed packages
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 19 Nov 2015 02:31:30 +0000 (21:31 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 19 Nov 2015 02:58:52 +0000 (21:58 -0500)
Makefile
functions/main
stage2/Makefile
stage2/hv-install-1
stage2/hv-install-2
stage3/Makefile
stage3/hv-install-1
stage4/Makefile
stage4/hv-install-1
stage5/Makefile
stage5/hv-install-1

index cd1e6e7..37a2336 100644 (file)
--- 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 \
index 2801230..72205ec 100644 (file)
@@ -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
index b5595fc..2f52a67 100644 (file)
@@ -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
index db8b333..26872a2 100755 (executable)
@@ -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"
index 531d57e..6f0fb78 100755 (executable)
@@ -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
index b5595fc..2f52a67 100644 (file)
@@ -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
index 9e3eae8..1990076 100755 (executable)
@@ -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 $?
index 84ec796..1b7d173 100644 (file)
@@ -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
index 721948d..fecfd30 100755 (executable)
@@ -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 $?
index b5595fc..2f52a67 100644 (file)
@@ -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
index 9677c03..bffcba4 100755 (executable)
@@ -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 $?