Skip to content

Commit

Permalink
The current sed script delete everything (#225)
Browse files Browse the repository at this point in the history
* The current sed script delete everything

This easy fix, while not super robust, seems a first good patch

* Clean only when there is more then one status

* Sync Changelog
  • Loading branch information
pizzamig committed Sep 16, 2022
1 parent 8b74255 commit 10c837d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- set-status: fix a bug that delete the status (#224)

## [0.15.0] 2022-09-11
### Added
- mount-out: new command to remove or unmount a previously mount-in folder or fs
Expand Down
8 changes: 5 additions & 3 deletions share/pot/set-status.sh
Expand Up @@ -43,9 +43,11 @@ _set_status()

echo "pot.status=$_new_status" >> "$_status_file"
# remove first (and outdated) occurrence of pot.status
${SED} -i '' -n -e ":a" \
-e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \
-e "p;n;ba" "$_status_file"
if [ "$(grep -c "^pot\.status=" "$_status_file")" -gt 1 ]; then
${SED} -i '' -n -e ":a" \
-e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \
-e "p;n;ba" "$_status_file"
fi
}

pot-set-status()
Expand Down

0 comments on commit 10c837d

Please sign in to comment.