Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/tools/pm_unapply
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PM_VAR_DIR="/tmp/patchmanager3"
PATCH_ROOT_DIR="/usr/share/patchmanager/patches"

# Paths / Files
PARAMETER="$1"
PATCH_DIR="$PATCH_ROOT_DIR/$1"

PM_LOG_FILE="$PM_VAR_DIR/patchmanager.log"
Expand Down Expand Up @@ -106,30 +107,35 @@ clean_backup_patch() {
#

if [ ! -f "$PM_LOG_FILE" ]; then
log "*** Patch-log created by pm_unapply script $(date) ***"
log "*** Patch-log created by pm_unapply script $(date -Iseconds) ***"
fi

log
log "----------------------------------"
log "pm_unapply $(date)"
log "pm_unapply $(date -Iseconds)"
log "----------------------------------"
log

log "$(basename "$PATCH_DIR")"

log "Using patch file: $PATCH_FILE"
if [ -z "$PARAMETER" ]; then
log "ERROR: A parameter must be provided for unapplying!"
failure
fi

if [ -f "$PATCH_FILE" ]; then
log " contains text patch"
if [ ! -d "$PATCH_DIR" ]; then
log "ERROR: $PATCH_DIR is not a directory or does not exist!"
failure
fi

log "$(basename "$PATCH_DIR")"
log

if [ ! -x "$PATCH_EXEC" ]; then
log "ERROR: Cannot find patch executable $PATCH_EXEC"
log "ERROR: Cannot use patch executable ${PATCH_EXEC}!"
failure
fi

log "Using patch file: $PATCH_FILE"

if [ ! -f "$PATCH_FILE" ]; then
log "ERROR: Cannot find patch file!"
failure
Expand Down