Skip to content

Instantly share code, notes, and snippets.

@jack126guy
Last active March 5, 2021 06:38
Show Gist options
  • Save jack126guy/afea42d726765a7d1203 to your computer and use it in GitHub Desktop.
Save jack126guy/afea42d726765a7d1203 to your computer and use it in GitHub Desktop.
"apt-get-rekt" Debian package contents
#!/bin/sh
APT_GET_REAL="apt-get.real"
EXIT_FAILURE=100
if [ "$#" -lt 1 ]; then
#No action specified
$APT_GET_REAL #Print default help
echo 'Get rekt.'
exit
else
if [ "$1" = "rekt" ]; then
#Get rekt
#Simulate real apt-get's root requirement
if [ "`id -u`" -eq "0" ]; then
echo "rekt"
exit
else
echo 'E: Need to be root' 1>&2
exit $EXIT_FAILURE
fi
else
$APT_GET_REAL $@
fi
fi
.TH APT-GET-REKT 8 "Version 1.5"
.SH NAME
apt-get-rekt - get rekt with apt-get
.SH SYNOPSIS
.B apt-get rekt
.SH DESCRIPTION
This utility extends apt-get with a humorous command.
.SH BACKGROUND
This is based on the flair of one of the moderators of
.nh
/r/linuxmasterrace
.hy 1
on Reddit.
.SH AUTHOR
Jack126Guy <someanon126@gmail.com>
.SH COPYRIGHT
The program and this manual are released into the public domain under
Creative Commons CC0 1.0 Universal:
<http://creativecommons.org/publicdomain/zero/1.0/>
.SH SEE ALSO
.BR apt-get (8)
Package: apt-get-rekt
Version: 1.5
Section: misc
Priority: optional
Architecture: all
Pre-Depends: apt
Replaces: apt
Installed-Size: 1
Maintainer: Jack126Guy <someanon126@gmail.com>
Description: Get rekt with apt-get
This package modifies apt-get to add a new
command.
.
It is a joke based on the flair of one of the
moderators of the subreddit /r/linuxmasterrace.
#!/bin/sh
APT_GET_REAL="apt-get.real"
APT_DIR="/usr/bin"
cd $APT_DIR
if [ -e "$APT_GET_REAL" -a "$1" != upgrade ]; then
mv "$APT_GET_REAL" apt-get
fi
#!/bin/sh
APT_GET_REAL="apt-get.real"
APT_DIR="/usr/bin"
cd $APT_DIR
if [ -e apt-get -a "$1" != upgrade ]; then
mv apt-get "$APT_GET_REAL"
fi
@jack126guy
Copy link
Author

The preinst and postrm scripts manipulate the original apt-get binary directly, and when apt is updated bad things happen. This should be handled with diversions instead.

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