Skip to content

apt works as well as aptitude; shellcheck’d - #3

Open
egberts wants to merge 13 commits into
abradley:masterfrom
egberts:master
Open

apt works as well as aptitude; shellcheck’d#3
egberts wants to merge 13 commits into
abradley:masterfrom
egberts:master

Conversation

@egberts

@egberts egberts commented Oct 12, 2021

Copy link
Copy Markdown

this is basically a strengthened dpkg-diffs that now works with filenames having a blank character in it.

also works with apt as well as aptitude as some platform do not have aptitude installed (most servers).

pjkundert and others added 13 commits December 7, 2012 13:55
… but"

- Some of the Debian system do not have 'aptitude' installed, but have 'apt' installed.  Make this script work with either.

- Not all cases of invalid CLI options are being handled.  Add '*' to the case block.  (shellcheck SC2220)

- Append additional handler to 'cd ...' with exit 1 (shellcheck SC2164)

- Clarify the logic to ensure that it is not ambiguous.  (shellcheck SC2186)

- 'read' mangles '/' so add an '-r' options to compensate for this.  (shellcheck SC2162)

- If the script name has a space, compensate for this by adding quotes around the '$0'.

- If the filename in a package has a space, compensate for this quirk by adding quotes around variables containing its blank-inserted filename.

- Clarify logic to ensure that it is not ambiguous (shellcheck)

- Add a shellcheck exemption requested for 'ls -A' which is immensely preferable over 'find $tempDir -type f'

- Removed trailing spaces
(Lots of Debian host do not have 'aptitude'; but 'apt', they do)
- Update Changlog
- Bump version to 0.1.2

@pkienzle pkienzle left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine and it runs on my system without aptitude. @abradley will probably want the Codacy dependency removed before pulling.

with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to drop codacy connection. Secrets will not be available to abradley? Also, the badge below references github user egberts.

Comment thread dpkg-diffs
cd "$tempDir"
aptitude download $1 >&2 || die "Aptitude download failed."
cd "$tempDir" || echo "$tempDir directory is not accessible." || exit 1
whereis_aptitude="$(whereis -b aptitude | awk '{print $2}')"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother with aptitude if apt works?

Comment thread dpkg-diffs
fi
if [ ! -e $foundFile ]; then
if [ ! -e "$foundFile" ]; then
echo "No package matching \"$1\" found in cache." >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to include the following for those who don't read docs: Use -d to download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants