Last active
September 30, 2018 21:43
-
-
Save se4u/dd55ad6d7ca77c673f6fe424c81714cf to your computer and use it in GitHub Desktop.
apt-get packages without sudo and use by overriding LD_PRELOAD or LD_LIBRARY_PATH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## https://askubuntu.com/a/423555/625555 | |
## There is also libapt, and python-dpkg and other packages that | |
## can talk to ubuntu package managers. | |
name=libqt5sql5 | |
CMDPFX=echo | |
DEPS="$(apt-cache depends $name | grep Depends | awk '{print $2}')" | |
i=0 | |
while [[ $i < ${#DEPS} ]] ; do | |
i=$(( i + 1 )) | |
# dpkg -s libpng16-16 | grep Status | wc -l | |
if [[ $(dpkg -l | grep libc6 | wc -l) == 0 ]]; then | |
DEPS="$DEPS"" $(apt-cache depends $name | grep Depends | awk '{print $2}')" | |
fi | |
done | |
i=${#DEPS} | |
mkdir tmp | |
while [[ $i >= 0 ]]; do | |
i=$(( i - 1 )) | |
name=${DEPS[i]} | |
$CMDPFX aptitude download $name | |
# dpkg -i --force-not-root --root=$HOME package.deb | |
$CMDPFX dpkg -x ${name}*.deb ./ | |
## cp -R usr/ tmp | |
$CMDPFX cp -R usr/* tmp/ | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment