Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # just in case we are retrying and apt is in a bad state
- dpkg --configure -a
- # DEBIAN_FRONTEND=noninteractive is useful for scripting.
- # prevents getting prompts that will hang our script.
- # ubuntu-minimal is a meta package that depends on the packages
- # in ubuntu-minimal install.
- # Need aptitude to autoremove everything we don't depend on.
- DEBIAN_FRONTEND=noninteractive \
- apt-get --assume-yes install aptitude ubuntu-minimal
- # mark all packages as automatically installed except
- # ubuntu-minimal, kernel, systemd and openssh.
- # For some reason systemd isn't part of ubuntu-minimal.
- # Any dependencies of these four packages will be kept.
- # All others that aren't dependencies will be removed since
- # we have told apt they are automatically installed
- # (ie we don't care about them unless we need them as a dep)
- DEBIAN_FRONTEND=noninteractive \
- aptitude --assume-yes markauto \
- '~i!?name(ubuntu-minimal~|linux-generic~|systemd~|openssh-server|grub~|lvm2~)'
- # purge all removed packages that were not purged.
- # removes leftover config/cruft.
- DEBIAN_FRONTEND=noninteractive \
- aptitude --assume-yes purge '~c'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement