Commit 52c362bf authored by Pierre-Yves Fourmond's avatar Pierre-Yves Fourmond

Fixed Issue #10

parent a2490b63
......@@ -272,27 +272,33 @@ read_metadata() {
return 1
fi
# Values set in metadata file
LIAR_NAME=""
LIAR_FOLDER=""
LIAR_TIMESTAMP=""
LIAR_FILE_PATH=""
LIAR_SOURCE_FILE_PATH=""
LIAR_SHA1=""
LIAR_VERSION=""
LIAR_FOLDER=""
# Values computed from previous ones
LIAR_FILE_NAME=""
LIAR_DATE=""
LIAR_TIME=""
LIAR_LINKS=""
LIAR_LINKS_COUNT="0"
. "$install_metadata"
[ -z "$LIAR_NAME" ] && LIAR_NAME=$NAME
[ -z "$LIAR_FOLDER" ] && LIAR_FOLDER=$(ls "$install_folder" | head -1)
[ -z "$LIAR_TIMESTAMP" ] && LIAR_TIMESTAMP=$(date -r "$install_folder" +%s)
[ -z "$LIAR_SOURCE_FILE_PATH" ] && LIAR_SOURCE_FILE_PATH="$LIAR_FILE_PATH"
[ -z "$LIAR_VERSION" ] && LIAR_VERSION="0.2-dev"
[ -z "$LIAR_VERSION" ] && LIAR_VERSION="$VERSION"
[ -z "$LIAR_FOLDER" ] && LIAR_FOLDER=$(ls "$install_folder" | head -1)
LIAR_DATE="$(date --date="@$LIAR_TIMESTAMP" +"%D %T")"
LIAR_FILE_NAME="$(basename $LIAR_FILE_PATH)"
LIAR_DATE="$(date --date="@$LIAR_TIMESTAMP" +"%D")"
LIAR_TIME="$(date --date="@$LIAR_TIMESTAMP" +"%T")"
LIAR_LINKS="$install_folder/.liar_links"
[ -f "$LIAR_LINKS" ] && LIAR_LINKS_COUNT="$(wc -l < "$LIAR_LINKS")"
......@@ -597,18 +603,22 @@ liar_list() {
echo "Listing installed software in '$DEST_FOLDER'"
if [ -n "$VERBOSE" ]; then
printf "\n%-14s %-18s %-38s %-10s %-19s %-6s\n\n" "Name" "Folder" "File Path" "Sha1" "Date" "Links"
printf "\n%-14s %-18s %-38s %-10s %-10s %-10s %-6s\n\n" \
"Name" "Folder" "File Name" "Sha1" "Date" "Time" "Links"
else
printf "\n%-14s %-18s %-38s %-19s\n\n" "Name" "Folder" "File Path" "Date"
printf "\n%-14s %-18s %-38s %-10s\n\n" \
"Name" "Folder" "File Name" "Date"
fi
names=$(ls -t "$DEST_FOLDER")
for NAME in $names; do
if read_metadata "$DEST_FOLDER/$NAME" 2>/dev/null; then
if [ -n "$VERBOSE" ]; then
printf "%-14.12s %-18.16s %-38.36s %-10.8s %-19s %-6s\n" "$LIAR_NAME" "$LIAR_FOLDER" "$(basename $LIAR_FILE_PATH)" "$LIAR_SHA1" "$LIAR_DATE" "$LIAR_LINKS_COUNT"
printf "%-14.12s %-18.16s %-38.36s %-10.8s %-10.8s %-10.8s %-6s\n" \
"$LIAR_NAME" "$LIAR_FOLDER" "$LIAR_FILE_NAME" "$LIAR_SHA1" "$LIAR_DATE" "$LIAR_TIME" "$LIAR_LINKS_COUNT"
else
printf "%-14.12s %-18.16s %-38.36s %-19s\n" "$LIAR_NAME" "$LIAR_FOLDER" "$(basename $LIAR_FILE_PATH)" "$LIAR_DATE"
printf "%-14.12s %-18.16s %-38.36s %-10.8s\n" \
"$LIAR_NAME" "$LIAR_FOLDER" "$LIAR_FILE_NAME" "$LIAR_DATE"
fi
fi
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment