Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment has two parts p2a and p2b. Problem A: We need a new mechanism to identify apps that have been installed on the system

This assignment has two parts p2a and p2b.

Problem A: We need a new mechanism to identify apps that have been installed on the system and have never been removed. We will use the dpkg.log file to get information of the installation history; however, it just handles one server. You can find dpkg.log in /usr/local/courses/rslavin/cs3423/2018Sp/assignment2. Copy this file to your project directory.

Find any program which has been installed but not removed from this file. For instance, in the example above the program languagepackenbase (5th line) meets the criteria but the program flex (8th line) does not since it was removed later.

We suggest creating two files, one with all the installed programs and one with all the removed programs, and using the difference of the two to find only those who have been installed but not removed.

Example:

Installed file: languagepackenbase flex

Removed file:

grublegacyec2

flex

libfldev

Matching on install. Where is the word install we want to match which indicates that the program was installed? If we just match "install" anywhere on the line, it could match programs which have the word install in the name. Also, we would match status lines (e.g., status installed) that are only intermediate steps in the installation.

Problem B: For this problem, we will want to get the same result, but this time we are going to consider if a program was installed again after being removed.

Steps: Consider using the installed/removed files from the previous problem

The uniq c command can be used to get a count of each unique value

Then you only need to find those items which have a higher install count than removed count You may use intermediate output files to store programs and their install/remove counts, just be sure to remove them by the end of execution

Hint: grep can be used to search a particular file using a regular expression. If you can identify the number of installations for an application, you can use grep to search for the same application in your temporaryuninstallcount file to compare values.

What to turn in

A LastnameFirstname.zip file containing at least the following:

p2a.bash a bash script which executes part A. The final result should be output to

p2a.out using p2AInstalled.sed and p2bRemoved.sed

p2aInstalled.sed a sed file which produces records of installed files

p2bRemoved.sed a sed file which produces records of removed files

p2b.bash a bash script which executes part B. The final result should be output to p2b.out

Be sure that your scripts remove any intermediate files created. After running p2a.bash and p2b.bash (the only scripts which should be run), the only new files that should exist are p2a.out and p2b.out.

dpkg.log The file content:

2018-01-03 09:36:09 startup archives unpack

2018-01-03 09:36:16 upgrade firefox:amd64 57.0.1+build2-0ubuntu0.14.04.1 5 7.0.3+build1-0ubuntu0.14.04.1

2018-01-03 09:36:16 status half-configured firefox:amd64 57.0.1+build2-0ub untu0.14.04.1

2018-01-03 09:36:16 status unpacked firefox:amd64 57.0.1+build2-0ubuntu0.1 4.04.1

2018-01-03 09:36:16 status half-installed firefox:amd64 57.0.1+build2-0ubu ntu0.14.04.1

2018-01-03 09:36:21 status triggers-pending hicolor-icon-theme:all 0.13-1

2018-01-03 09:36:21 status half-installed firefox:amd64 57.0.1+build2-0ubu ntu0.14.04.1

2018-01-03 09:36:21 status triggers-pending desktop-file-utils:amd64 0.22- 1ubuntu1.1

2018-01-03 09:36:21 status half-installed firefox:amd64 57.0.1+build2-0ubu ntu0.14.04.1

2018-01-03 09:36:21 status triggers-pending gnome-menus:amd64 3.10.1-0ubun tu2

2018-01-03 09:36:21 status triggers-pending mime-support:all 3.54ubuntu1.1

2018-01-03 09:36:21 status triggers-pending man-db:amd64 2.6.7.1-1ubuntu1

2018-01-03 09:36:21 status half-installed firefox:amd64 57.0.1+build2-0ubu ntu0.14.04.1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions