Skip to content

Instantly share code, notes, and snippets.

@sulincix
Last active August 5, 2021 07:46
Show Gist options
  • Save sulincix/daf2f7a02f47ade84cccc4a6a866266e to your computer and use it in GitHub Desktop.
Save sulincix/daf2f7a02f47ade84cccc4a6a866266e to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script revoke usrmerge.
# You must save your unsaved files before run.
# System or applications may crash during process.
# You must reboot after script finished.
# This script is experimental.
set +e
apt-get install busybox-static -yq || exit 1
cp /bin/busybox /busybox
[[ -d /var/lib/dpkg/info/ ]] || exit 1
for dir in lib bin sbin lib32 lib64 libx32 ; do
/busybox rm -f /$dir && /busybox mkdir /$dir
/busybox cat /var/lib/dpkg/info/*.list | /busybox grep "^/$dir" | while read line ; do
nd="$(/busybox dirname $line)"
[[ ! -d "$nd" ]] && /busybox mkdir -p "$nd"
[[ ! -d "/usr/$line" ]] && /busybox mv /usr/$line $line
done
done
depmod -a
reboot -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment