#!/bin/sh
#] 
#] *********************
#] bash  "$d_bin"'apps installed.sh'  - $ dpkg -l : lists downloaded software, diff vs earlier list
# www.BillHowell.ca  01Dec2022 initial, 15Jan2024 added comment lines to output files
# 08Apr2025 major upgrade -> [software name, diff, z_Archive]
# view in text editor, using constant-width font (eg courier), tabWidth = 3

# notesNetwork:  
#  	"$d_PROJECTS"'SysMaint-secure/setup [bin, qnial, apps, etc]/apps list notes.txt' 
#  	"$d_bin"'apps installed.sh' 
#  	security : 
#  	"$d_SysMaint"'remote access/sandboxing notes.txt'
#  	"$d_SysMaint"'remote access/remote access notes.txt'
#24********************************24


#24************************24
# Setup 

source "$d_bin"'fileops.sh' 		# library of handy bash functions for file needs


# 15Jan2024 rpm command downloaded from LMDE Software Manager
#24************************24


date_ddmmmyyyy=$(date +%0e%0b%0Y)

dAppL="$d_PROJECTS"'SysMaint-secure/setup [bin, qnial, apps, etc]/'

pAppRawL="$dAppL"'apps list raw.txt'  
pAppNamL="$dAppL"'apps list names.txt'  
pAppHisL="$dAppL"'apps list names 250408.txt'  
pDifNamL="$dAppL"'apps list diff.txt'  

# +-----+
if  [ -f  "$pAppRawL" ]; then  pinn_archiveLocal  "$pAppRawL";  fi
if  [ -f  "$pAppNamL" ]; then  pinn_archiveLocal  "$pAppNamL";  fi
if  [ -f  "$pDifNamL" ]; then  pinn_archiveLocal  "$pDifNamL";  fi


# +-----+
echo   >"$pAppRawL"  ''
echo  >>"$pAppRawL"  '24************************24'
echo  >>"$pAppRawL"  "$pAppRawL"' - including libs'
echo  >>"$pAppRawL"  "$date_ddmmmyyyy "'  "$d_bin"apps installed.sh'
echo  >>"$pAppRawL"  ''

dpkg -l  >>"$pAppRawL"

# +-----+
echo   >"$pAppNamL"  ''
echo  >>"$pAppNamL"  '24************************24'
echo  >>"$pAppNamL"  "$pAppNamL"
echo  >>"$pAppNamL"  "$date_ddmmmyyyy "'  "$d_bin"apps installed.sh'
echo  >>"$pAppNamL"  ''

grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([:+.A-Za-z0-9-]*\)[ ]*.*|\1|'   >>"$pAppNamL"
diff  "$pAppHisL"  "$pAppNamL"  --suppress-common-lines  >"$pDifNamL"


# 08Apr2025 check 
# $ dAppL="$d_PROJECTS"'SysMaint-secure/setup [bin, qnial, apps, etc]/'
# $ pAppRawL="$dAppL"'apps list raw.txt'  
# $ pAppNamL="$dAppL"'apps list names.txt'  
# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([A-Za-z0-9]*\)[ ]*.*|\1|'   >"$pAppNamL"

# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([A-Za-z0-9\-\:]*\)[ ]*.*|\1|'   >"$pAppNamL" NOT[-:] terms
# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([A-Za-z0-9-]*\)[ ]*.*|\1|'   >"$pAppNamL"  Yes - terms
# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([A-Za-z0-9-\:]*\)[ ]*.*|\1|'   >"$pAppNamL" Error
# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([:A-Za-z0-9-]*\)[ ]*.*|\1|'   >"$pAppNamL"  missing +. names
# $ grep  '^ii  '  "$pAppRawL"  |  sed  's|ii  \([:+.A-Za-z0-9-]*\)[ ]*.*|\1|'   >"$pAppNamL" OK!!???




# enddoc
