Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
sbin /
[ HOME SHELL ]
Name
Size
Permission
Action
MAKEDEV
28.14
KB
-rwxr-xr-x
accton
10.45
KB
-rwxr-xr-x
addpart
8.26
KB
-rwxr-xr-x
agetty
26.09
KB
-rwxr-xr-x
alsactl
101.37
KB
-rwxr-xr-x
arp
61.37
KB
-rwxr-xr-x
arping
17.48
KB
-rwxr-xr-x
audispd
38.02
KB
-rwxr-x---
auditctl
38.03
KB
-rwxr-x---
augenrules
3.48
KB
-rwxr-x---
aureport
95.78
KB
-rwxr-xr-x
ausearch
93.02
KB
-rwxr-xr-x
autrace
16.13
KB
-rwxr-x---
badblocks
29.05
KB
-rwxr-xr-x
biosdevname
37.26
KB
-rwxr-xr-x
blkdeactivate
13.25
KB
-rwxr-xr-x
blkdiscard
18.73
KB
-rwxr-xr-x
blkid
27.17
KB
-rwxr-xr-x
blockdev
17.21
KB
-rwxr-xr-x
bridge
53.63
KB
-rwxr-xr-x
busybox
1021.48
KB
-rwxr-xr-x
cache_check
1.54
MB
-rwxr-xr-x
cache_dump
1.54
MB
-rwxr-xr-x
cache_metadata_size
1.54
MB
-rwxr-xr-x
cache_repair
1.54
MB
-rwxr-xr-x
cache_restore
1.54
MB
-rwxr-xr-x
cbq
32.77
KB
-rwxr-xr-x
cfdisk
68.41
KB
-rwxr-xr-x
chcpu
29.11
KB
-rwxr-xr-x
chkconfig
36.07
KB
-rwxr-xr-x
clock
47.52
KB
-rwxr-xr-x
consoletype
7.71
KB
-rwxr-xr-x
cryptsetup
43.6
KB
-rwxr-xr-x
ctrlaltdel
8.39
KB
-rwxr-xr-x
debugfs
94.08
KB
-rwxr-xr-x
delpart
8.22
KB
-rwxr-xr-x
depmod
133.05
KB
-rwxr-xr-x
dm_dso_reg_tool
13.6
KB
-rwxr-xr-x
dmevent_tool
13.6
KB
-rwxr-xr-x
dmeventd
42.18
KB
-r-xr-xr-x
dmraid
26.27
KB
-rwxr-xr-x
dmraid.static
26.27
KB
-rwxr-xr-x
dmsetup
142.03
KB
-rwxr-xr-x
dmstats
142.03
KB
-rwxr-xr-x
dosfsck
54.05
KB
-rwxr-xr-x
dosfslabel
51.06
KB
-rwxr-xr-x
dracut
11.86
KB
-rwxr-xr-x
dumpe2fs
22.74
KB
-rwxr-xr-x
e2fsck
192.73
KB
-rwxr-xr-x
e2image
28.74
KB
-rwxr-xr-x
e2label
41.73
KB
-rwxr-xr-x
e2undo
14.25
KB
-rwxr-xr-x
era_check
1.54
MB
-rwxr-xr-x
era_dump
1.54
MB
-rwxr-xr-x
era_invalidate
1.54
MB
-rwxr-xr-x
era_restore
1.54
MB
-rwxr-xr-x
ether-wake
14.37
KB
-rwxr-xr-x
ethtool
233.75
KB
-rwxr-xr-x
faillock
14.57
KB
-rwxr-xr-x
fdisk
112.05
KB
-rwxr-xr-x
findfs
9.38
KB
-rwxr-xr-x
fixfiles
7.75
KB
-rwxr-xr-x
fsadm
14.88
KB
-r-xr-xr-x
fsck
33.87
KB
-rwxr-xr-x
fsck.cramfs
15.82
KB
-rwxr-xr-x
fsck.ext2
192.73
KB
-rwxr-xr-x
fsck.ext3
192.73
KB
-rwxr-xr-x
fsck.ext4
192.73
KB
-rwxr-xr-x
fsck.ext4dev
192.73
KB
-rwxr-xr-x
fsck.msdos
54.05
KB
-rwxr-xr-x
fsck.vfat
54.05
KB
-rwxr-xr-x
fsfreeze
10.27
KB
-rwxr-xr-x
fstab-decode
8.14
KB
-rwxr-xr-x
fstrim
17.95
KB
-rwxr-xr-x
fuser
28.48
KB
-rwxr-xr-x
genhostid
7.91
KB
-rwxr-xr-x
getkey
11.71
KB
-rwxr-xr-x
grub
740.84
KB
-rwxr-xr-x
grub-crypt
2.41
KB
-rwxr-xr-x
grub-install
18
KB
-rwxr-xr-x
grub-md5-crypt
2.24
KB
-rwxr-xr-x
grub-terminfo
2.42
KB
-rwxr-xr-x
grubby
50.31
KB
-rwxr-xr-x
halt
14.48
KB
-rwxr-xr-x
hdparm
108.85
KB
-rwxr-xr-x
hwclock
47.52
KB
-rwxr-xr-x
ifcfg
2.98
KB
-rwxr-xr-x
ifconfig
72.23
KB
-rwxr-xr-x
ifdown
1.47
KB
-rwxr-xr-x
ifenslave
21.65
KB
-rwxr-xr-x
ifrename
31.43
KB
-rwxr-xr-x
ifup
4.58
KB
-rwxr-xr-x
initctl
135.53
KB
-rwxr-xr-x
insmod
13.79
KB
-rwxr-xr-x
insmod.static
784.58
KB
-rwxr-xr-x
install-info
42.56
KB
-rwxr-xr-x
installkernel
2.61
KB
-rwxr-xr-x
ip
241.45
KB
-rwxr-xr-x
ip6tables
49.64
KB
-rwxr-xr-x
ip6tables-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-multi
49.64
KB
-rwxr-xr-x
ip6tables-multi-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-restore
49.64
KB
-rwxr-xr-x
ip6tables-restore-1.4.7
49.64
KB
-rwxr-xr-x
ip6tables-save
49.64
KB
-rwxr-xr-x
ip6tables-save-1.4.7
49.64
KB
-rwxr-xr-x
ipmaddr
18.92
KB
-rwxr-xr-x
iptables
58.45
KB
-rwxr-xr-x
iptables-1.4.7
58.45
KB
-rwxr-xr-x
iptables-multi
58.45
KB
-rwxr-xr-x
iptables-multi-1.4.7
58.45
KB
-rwxr-xr-x
iptables-restore
58.45
KB
-rwxr-xr-x
iptables-restore-1.4.7
58.45
KB
-rwxr-xr-x
iptables-save
58.45
KB
-rwxr-xr-x
iptables-save-1.4.7
58.45
KB
-rwxr-xr-x
iptunnel
22.75
KB
-rwxr-xr-x
iw
160.43
KB
-rwxr-xr-x
iwconfig
29.58
KB
-rwxr-xr-x
iwevent
18.23
KB
-rwxr-xr-x
iwgetid
14.06
KB
-rwxr-xr-x
iwlist
35.68
KB
-rwxr-xr-x
iwpriv
14.87
KB
-rwxr-xr-x
iwspy
13.94
KB
-rwxr-xr-x
kdump
10.83
KB
-rwxr-xr-x
kexec
176.1
KB
-rwxr-xr-x
killall5
19.98
KB
-rwxr-xr-x
kpartx
38.43
KB
-rwxr-xr-x
ldconfig
878.12
KB
-rwxr-xr-x
load_policy
10.21
KB
-rwxr-xr-x
logsave
12.8
KB
-rwxr-xr-x
losetup
31.2
KB
-rwxr-xr-x
lsinitrd
3.93
KB
-rwxr-xr-x
lsmod
8.88
KB
-rwxr-xr-x
lspci
70.12
KB
-rwxr-xr-x
lspcmcia
35.33
KB
-rwxr-xr-x
lvchange
1.46
MB
-r-xr-xr-x
lvconvert
1.46
MB
-r-xr-xr-x
lvcreate
1.46
MB
-r-xr-xr-x
lvdisplay
1.46
MB
-r-xr-xr-x
lvextend
1.46
MB
-r-xr-xr-x
lvm
1.46
MB
-r-xr-xr-x
lvmchange
1.46
MB
-r-xr-xr-x
lvmconf
12.39
KB
-r-xr-xr-x
lvmconfig
1.46
MB
-r-xr-xr-x
lvmdiskscan
1.46
MB
-r-xr-xr-x
lvmdump
9.43
KB
-r-xr-xr-x
lvmetad
66.09
KB
-r-xr-xr-x
lvmsadc
1.46
MB
-r-xr-xr-x
lvmsar
1.46
MB
-r-xr-xr-x
lvreduce
1.46
MB
-r-xr-xr-x
lvremove
1.46
MB
-r-xr-xr-x
lvrename
1.46
MB
-r-xr-xr-x
lvresize
1.46
MB
-r-xr-xr-x
lvs
1.46
MB
-r-xr-xr-x
lvscan
1.46
MB
-r-xr-xr-x
matchpathcon
12.01
KB
-rwxr-xr-x
mdmon
229.84
KB
-rwxr-xr-x
microcode_ctl
11.61
KB
-rwxr-xr-x
mii-diag
21.25
KB
-rwxr-xr-x
mii-tool
17.8
KB
-rwxr-xr-x
mingetty
18.7
KB
-rwxr-xr-x
mkdosfs
29.88
KB
-rwxr-xr-x
mkdumprd
120.65
KB
-rwxr-xr-x
mke2fs
67.34
KB
-rwxr-xr-x
mkfs
10.09
KB
-rwxr-xr-x
mkfs.cramfs
26.26
KB
-rwxr-xr-x
mkfs.ext2
67.34
KB
-rwxr-xr-x
mkfs.ext3
67.34
KB
-rwxr-xr-x
mkfs.ext4
67.34
KB
-rwxr-xr-x
mkfs.ext4dev
67.34
KB
-rwxr-xr-x
mkfs.msdos
29.88
KB
-rwxr-xr-x
mkfs.vfat
29.88
KB
-rwxr-xr-x
mkhomedir_helper
22.01
KB
-rwxr-xr-x
mkinitrd
3.33
KB
-rwxr-xr-x
mkswap
30.78
KB
-rwxr-xr-x
modinfo
95.34
KB
-rwxr-xr-x
modprobe
121.42
KB
-rwxr-xr-x
mount.cifs
39.59
KB
-rwxr-xr-x
mount.nfs
122.47
KB
-rwsr-xr-x
mount.nfs4
122.47
KB
-rwsr-xr-x
mount.tmpfs
1.31
KB
-rwxr-xr-x
nameif
15.26
KB
-rwxr-xr-x
netreport
8.59
KB
-rwxr-sr-x
new-kernel-pkg
13.57
KB
-rwxr-xr-x
nfs_cache_getent
460
B
-rwxr-xr-x
nologin
7.63
KB
-rwxr-xr-x
pam_console_apply
41.13
KB
-rwxr-xr-x
pam_tally2
16.87
KB
-rwxr-xr-x
parted
85.11
KB
-rwxr-xr-x
partprobe
14.98
KB
-rwxr-xr-x
partx
24.9
KB
-rwxr-xr-x
pccardctl
35.33
KB
-rwxr-xr-x
pdata_tools
1.54
MB
-rwxr-xr-x
pidof
19.98
KB
-rwxr-xr-x
pivot_root
7.61
KB
-rwxr-xr-x
plipconfig
10.52
KB
-rwxr-xr-x
poweroff
14.48
KB
-rwxr-xr-x
ppp-watch
29.08
KB
-rwxr-xr-x
pvchange
1.46
MB
-r-xr-xr-x
pvck
1.46
MB
-r-xr-xr-x
pvcreate
1.46
MB
-r-xr-xr-x
pvdisplay
1.46
MB
-r-xr-xr-x
pvmove
1.46
MB
-r-xr-xr-x
pvremove
1.46
MB
-r-xr-xr-x
pvresize
1.46
MB
-r-xr-xr-x
pvs
1.46
MB
-r-xr-xr-x
pvscan
1.46
MB
-r-xr-xr-x
quotacheck
103.01
KB
-rwxr-xr-x
quotaoff
72.5
KB
-rwxr-xr-x
quotaon
72.5
KB
-rwxr-xr-x
readahead
25.51
KB
-rwxr-xr-x
readahead-collector
27.76
KB
-rwxr-xr-x
reboot
14.48
KB
-rwxr-xr-x
reload
135.53
KB
-rwxr-xr-x
request-key
20.91
KB
-rwxr-xr-x
resize2fs
41.49
KB
-rwxr-xr-x
restart
135.53
KB
-rwxr-xr-x
restorecon
26.63
KB
-rwxr-xr-x
rfkill
12.13
KB
-rwxr-xr-x
rmmod
16.28
KB
-rwxr-xr-x
rngd
23.47
KB
-rwxr-xr-x
route
58.38
KB
-rwxr-xr-x
rtmon
37.7
KB
-rwxr-xr-x
runlevel
14.02
KB
-rwxr-xr-x
runuser
32.7
KB
-rwxr-xr-x
scsi_id
34.55
KB
-rwxr-xr-x
securetty
10.7
KB
-rwxr-xr-x
service
1.65
KB
-rwxr-xr-x
setfiles
26.63
KB
-rwxr-xr-x
setpci
23.37
KB
-rwxr-xr-x
setsysfont
850
B
-rwxr-xr-x
sfdisk
71.53
KB
-rwxr-xr-x
sgpio
16.36
KB
-rwxr-xr-x
shutdown
62.98
KB
-rwxr-xr-x
slattach
37.35
KB
-rwxr-xr-x
sln
676.6
KB
-rwxr-xr-x
start
135.53
KB
-rwxr-xr-x
status
135.53
KB
-rwxr-xr-x
stop
135.53
KB
-rwxr-xr-x
sulogin
16.6
KB
-rwxr-xr-x
sushell
67
B
-rwxr-xr-x
swapoff
29.69
KB
-rwxr-xr-x
swapon
29.69
KB
-rwxr-xr-x
switch_root
11.95
KB
-rwxr-xr-x
sysctl
18.92
KB
-rwxr-xr-x
tc
253.53
KB
-rwxr-xr-x
telinit
50.33
KB
-rwxr-xr-x
thin_check
1.54
MB
-rwxr-xr-x
thin_delta
1.54
MB
-rwxr-xr-x
thin_dump
1.54
MB
-rwxr-xr-x
thin_ls
1.54
MB
-rwxr-xr-x
thin_metadata_size
1.54
MB
-rwxr-xr-x
thin_repair
1.54
MB
-rwxr-xr-x
thin_restore
1.54
MB
-rwxr-xr-x
thin_rmap
1.54
MB
-rwxr-xr-x
thin_trim
1.54
MB
-rwxr-xr-x
tune2fs
41.73
KB
-rwxr-xr-x
umount.hal
11.94
KB
-rwxr-xr-x
umount.nfs
122.47
KB
-rwsr-xr-x
umount.nfs4
122.47
KB
-rwsr-xr-x
unix_chkpwd
34.02
KB
-rwsr-xr-x
vconfig
13.16
KB
-rwxr-xr-x
vgcfgbackup
1.46
MB
-r-xr-xr-x
vgcfgrestore
1.46
MB
-r-xr-xr-x
vgchange
1.46
MB
-r-xr-xr-x
vgck
1.46
MB
-r-xr-xr-x
vgconvert
1.46
MB
-r-xr-xr-x
vgcreate
1.46
MB
-r-xr-xr-x
vgdisplay
1.46
MB
-r-xr-xr-x
vgexport
1.46
MB
-r-xr-xr-x
vgextend
1.46
MB
-r-xr-xr-x
vgimport
1.46
MB
-r-xr-xr-x
vgimportclone
9.4
KB
-r-xr-xr-x
vgmerge
1.46
MB
-r-xr-xr-x
vgmknodes
1.46
MB
-r-xr-xr-x
vgreduce
1.46
MB
-r-xr-xr-x
vgremove
1.46
MB
-r-xr-xr-x
vgrename
1.46
MB
-r-xr-xr-x
vgs
1.46
MB
-r-xr-xr-x
vgscan
1.46
MB
-r-xr-xr-x
vgsplit
1.46
MB
-r-xr-xr-x
vmcore-dmesg
16.99
KB
-rwxr-xr-x
weak-modules
15.83
KB
-rwxr-xr-x
wipefs
16.19
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : weak-modules
#!/bin/bash # # weak-modules - determine which modules are kABI compatible with installed # kernels and set up the symlinks in /lib/*/weak-updates. # # Changelog: # # 2010/01/10 - Further updates for dracut use on Fedora/RHEL (jcm). # 2009/09/16 - Rebase and add a bunch of updates for dracut (jcm). unset LANG LC_ALL LC_COLLATE tmpdir=$(mktemp -td ${0##*/}.XXXXXX) trap "rm -rf $tmpdir" EXIT unset ${!changed_modules_*} ${!changed_initramfs_*} initramfs_prefix="/boot" # can customize here dracut="/sbin/dracut" if [ ! -x "$dracut" ] then echo "weak-modules: this tool requires a dracut-enabled kernel" exit 1 fi # doit: # A wrapper used whenever we're going to perform a real operation. doit() { [ -n "$verbose" ] && echo "$@" [ -n "$dry_run" ] || "$@" } # rpmsort: The sort in coreutils can't sort the RPM list how we want it so we # instead transform the list into a form it will sort correctly, then sort. rpmsort() { local IFS=$' ' REVERSE="" rpmlist=($(cat)) if [ "-r" == "$1" ]; then REVERSE="-r" fi echo ${rpmlist[@]} | \ sed -e 's/-/../g' | \ sort ${REVERSE} -n -t"." -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 \ -k8,8 -k9,9 -k10,10 | \ sed -e 's/\.\./-/g' } # read_modules_list: # Read in a list of modules from standard input. Convert the filenames into # absolute paths and compute the kernel release for each module (either using # the modinfo section or through the absolute path. read_modules_list() { local IFS=$'\n' modules=($(cat)) for ((n = 0; n < ${#modules[@]}; n++)); do if [ ${modules[n]:0:1} != '/' ]; then modules[n]="$PWD/${modules[n]}" fi if [ -f "${modules[n]}" ]; then module_krels[n]=$(krel_of_module ${modules[n]}) else # Try to extract the kernel release from the path set -- "${modules[n]#/lib/modules/}" module_krels[n]=${1%%/*} fi done } # read_old_initramfs: compare_initramfs_modules() { local old_initramfs=$1 local new_initramfs=$2 rm -rf "$tmpdir/old_initramfs" rm -rf "$tmpdir/new_initramfs" mkdir "$tmpdir/old_initramfs" mkdir "$tmpdir/new_initramfs" pushd "$tmpdir/old_initramfs" >/dev/null zcat "$old_initramfs" | cpio -i 2>/dev/null n=0; for i in `find . -iname \*.ko|sort`; do old_initramfs_modules[n]="$i" n=$((n+1)) done popd >/dev/null pushd "$tmpdir/new_initramfs" >/dev/null zcat "$new_initramfs" | cpio -i 2>/dev/null n=0; for i in `find . -iname \*.ko|sort`; do new_initramfs_modules[n]="$i" n=$((n+1)) done popd >/dev/null if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" ]; then for ((n = 0; n < ${#old_initramfs_modules[@]}; n++)); do old_md5=`md5sum $tmpdir/old_initramfs/${old_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` new_md5=`md5sum $tmpdir/new_initramfs/${new_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` if [ ! "$old_md5" == "$new_md5" ]; then return 1 fi done else return 1 fi return 0 } # check_initramfs: # check and possibly also update the initramfs for changed kernels check_initramfs() { local kernel=$1 # If there is no initramfs already we will not make one here. if [ -e "$initramfs_prefix/initramfs-$kernel.img" ]; then old_initramfs="$initramfs_prefix/initramfs-$kernel.img" tmp_initramfs="$initramfs_prefix/initramfs-$kernel.tmp" new_initramfs="$initramfs_prefix/initramfs-$kernel.img" $dracut -f "$tmp_initramfs" "$kernel" if ! $(compare_initramfs_modules "$old_initramfs" "$tmp_initramfs"); then doit mv "$tmp_initramfs" "$new_initramfs" else rm -f "$tmp_initramfs" fi fi } # krel_of_module: # Compute the kernel release of a module. krel_of_module() { declare module=$1 /sbin/modinfo -F vermagic "$module" | awk '{print $1}' } # module_is_compatible: # Determine if a module is compatible with a particular kernel release. Also # include any symbol deps that might be introduced by other external kmods. module_is_compatible() { declare module=$1 krel=$2 module_krel=$(krel_of_module "$module") if [ ! -e "$tmpdir/all-symvers-$krel-$module_krel" ]; then # Symbols exported by the "new" kernel if [ ! -e $tmpdir/symvers-$krel ]; then # Accept '.' in the symbol name to handle the .TOC. symbol on ppc if [ -e /boot/symvers-$krel.gz ]; then zcat /boot/symvers-$krel.gz \ | sed -r -ne 's:^(0x[0]*[0-9a-f]{8}\t[0-9a-zA-Z_.]+)\t.*:\1:p' fi > $tmpdir/symvers-$krel fi # Symbols exported by the add-on modules of the "new" kernel if [ ! -e "$tmpdir/addon-symvers-$krel" ]; then if [ -e /lib/modules/$krel/extra ] && \ [ -n "`find /lib/modules/$krel/extra -type f`" ]; then find /lib/modules/$krel/extra -name '*.ko' \ | xargs nm \ | sed -nre 's:^[0]*([0-9a-f]{8}) A __crc_(.*):0x\1 \2:p' fi > $tmpdir/addon-symvers-$krel fi # Symbols that other add-on modules of the "old" kernel export # (and that this module may require) if [ ! -e "$tmpdir/extra-symvers-$module_krel" ]; then if [ -e /lib/modules/$module_krel/extra ] && \ [ -n "`find /lib/modules/$module_krel/extra -type f`" ]; then find /lib/modules/$module_krel/extra -name '*.ko' \ | xargs nm \ | sed -nre 's:^[0]*([0-9a-f]{8}) A __crc_(.*):0x\1 \2:p' fi > $tmpdir/extra-symvers-$module_krel fi sort -u $tmpdir/symvers-$krel \ $tmpdir/extra-symvers-$module_krel \ $tmpdir/addon-symvers-$krel \ > "$tmpdir/all-symvers-$krel-$module_krel" fi # If the module does not have modversions enabled, $tmpdir/modvers # will be empty. /sbin/modprobe --dump-modversions "$module" \ | sed -r -e 's:^(0x[0]*[0-9a-f]{8}\t.*):\1:' \ | sort -u \ > $tmpdir/modvers # Only include lines of the second file in the output that don't # match lines in the first file. (The default separator is # <space>, so we are matching the whole line.) join -j 1 -v 2 $tmpdir/all-symvers-$krel-$module_krel \ $tmpdir/modvers > $tmpdir/join if [ ! -s $tmpdir/modvers ]; then echo "Warning: Module ${module##*/} from kernel $module_krel has no" \ "modversions, so it cannot be reused for kernel $krel" >&2 elif [ -s $tmpdir/join ]; then [ -n "$verbose" ] && echo "Module ${module##*/} from kernel $module_krel is not compatible" \ "with kernel $krel in symbols:" $(sed -e 's:.* ::' $tmpdir/join) else [ -n "$verbose" ] && echo "Module ${module##*/} from kernel $module_krel is compatible" \ "with kernel $krel" return 0 fi return 1 } usage() { echo "Usage: ${0##*/} [options] {--add-modules|--remove-modules}" echo "${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release}" cat <<'EOF' --add-modules Add a list of modules read from standard input. Create symlinks in compatible kernel's weak-updates/ directory. The list of modules is read from standard input. --remove-modules Remove compatibility symlinks from weak-updates/ directories for a list of modules. The list of modules is read from standard input. Optionally specify --delete-modules to prevent weak-modules from attempting to locate any compatible modules to replace those being removed. --add-kernel Add compatibility symlinks for all compatible modules to the specified or running kernel. --remove-kernel Remove all compatibility symlinks for the specified or current kernel. --no-initramfs Do not generate an initramfs. --verbose Print the commands executed. --dry-run Do not create/remove any files. EOF exit $1 } # module_has_changed: # Mark if an actual change occured that we need to deal with later by calling # depmod or mkinitramfs against the affected kernel. module_has_changed() { declare module=$1 krel=$2 module=${module%.ko} module=${module##*/} eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel" eval "changed_initramfs_${krel//[^a-zA-Z0-9]/_}=$krel" } # add_modules: # Read in a list of modules from stdinput and process them for compatibility # with installed kernels under /lib/modules. add_modules() { read_modules_list || exit 1 if [ ${#modules[@]} -gt 0 ]; then for krel in $(ls /lib/modules/); do [ -e "/boot/symvers-$krel.gz" ] || continue for ((n = 0; n < ${#modules[@]}; n++)); do module="${modules[n]}" module_krel="${module_krels[n]}" case "$module" in /lib/modules/$krel/*) # Module was built against this kernel, update initramfs. module_has_changed $module $krel continue ;; esac # Module my also serve as a weak-update built against another # kernel. We need to create symlinks for compatible kernels # under /lib/modules and rerun depmod/dracut for those. subpath=`echo $module | sed -nre "s:/lib/modules/$module_krel/([^/]*)/(.*):\2:p"` weak_module="/lib/modules/$krel/weak-updates/${subpath#/}" if [ -r "$weak_module" ]; then weak_krel=$(krel_of_module "$weak_module") if [ "$weak_krel" != "$module_krel" ] && [ "$(printf "%s\n" "$weak_krel" "$module_krel" \ | rpmsort | (read input; echo "$input"; \ while read input; do true; done))" = \ "$module_krel" ]; then # Keep modules from more recent kernels. [ -n "$verbose" ] && echo \ "Keeping module ${module##*/} from kernel $weak_krel for kernel $krel" continue fi fi if module_is_compatible $module $krel; then doit mkdir -p $(dirname $weak_module) doit ln -sf $module $weak_module # Module was built against another kernel, update initramfs. module_has_changed $module $krel fi done done fi } # remove_modules: # Read in a list of modules from stdinput and process them for removal. # Parameter is noreplace to delete modules, otherwise link compat. remove_modules() { delete_modules=${1:-replace} read_modules_list || exit 1 if [ ${#modules[@]} -gt 0 ]; then # Hunt for all known users of this module in /lib/modules, remove them # and create symlinks to other compatible modules (downgrade) if # possible, update initramfs for each modified kernel too. krels=($(ls /lib/modules/ | rpmsort -r)) for krel in "${krels[@]}"; do [ -e "/boot/symvers-$krel.gz" ] || continue for ((n = 0; n < ${#modules[@]}; n++)); do module="${modules[n]}" module_krel="${module_krels[n]}" # Module is going to be removed, update initramfs. module_has_changed $module $krel subpath="${module#/lib/modules/$module_krel/extra}" weak_module="/lib/modules/$krel/weak-updates/${subpath#/}" if [ "$module" == "`readlink $weak_module`" ]; then [ -n "$verbose" ] && echo \ "Removing compatible module ${module##*/} from kernel $krel" doit rm -f "$weak_module" if [ "replace" == "$delete_modules" ]; then for krel2 in "${krels[@]}"; do if [ $krel2 != $krel ]; then module="/lib/modules/$krel2/extra/${subpath#/}" [ -e "$module" ] || continue if module_is_compatible "$module" "$krel"; then [ -n "$verbose" ] && echo \ "Adding compatible module ${module##*/} from kernel $krel2 instead" doit ln -s "$module" "$weak_module" module_has_changed $module $krel break fi fi done fi # Remove the part of the directory beneath weak-updates ( cd "/lib/modules/$krel/weak-updates" && \ doit rmdir --parents --ignore-fail-on-non-empty "$(dirname "${subpath#/}")" ) fi done done fi } add_kernel() { add_krel=${1:-$(uname -r)} if [ ! -e "/boot/symvers-$add_krel.gz" ]; then echo "Symvers dump file /boot/symvers-$add_krel.gz" \ "not found" >&2 exit 1 fi for krel in $(ls /lib/modules/ | rpmsort -r); do [ "$add_krel" = "$krel" ] && continue [ -d /lib/modules/$krel/extra ] || continue for module in $(find /lib/modules/$krel/extra -name '*.ko'); do subpath="${module#/lib/modules/$krel/extra}" weak_module="/lib/modules/$add_krel/weak-updates/${subpath#/}" [ -e "$weak_module" ] && continue if module_is_compatible $module $add_krel; then module_has_changed $module $add_krel doit mkdir -p $(dirname $weak_module) doit ln -sf $module $weak_module fi done done } remove_kernel() { remove_krel=${1:-$(uname -r)} weak_modules="/lib/modules/$remove_krel/weak-updates" module_has_changed $weak_modules $remove_krel # Remove everything beneath the weak-updates directory ( cd "$weak_modules" && doit rm -rf * ) } ################################################################################ ################################## MAIN GUTS ################################### ################################################################################ options=`getopt -o h --long help,add-modules,remove-modules \ --long add-kernel,remove-kernel \ --long dry-run,no-initramfs,verbose,delete-modules -- "$@"` [ $? -eq 0 ] || usage 1 eval set -- "$options" while :; do case "$1" in --add-modules) do_add_modules=1 ;; --remove-modules) do_remove_modules=1 ;; --add-kernel) do_add_kernel=1 ;; --remove-kernel) do_remove_kernel=1 ;; --dry-run) dry_run=1 ;; --no-initramfs) no_initramfs=1 ;; --verbose) verbose=1 ;; --delete-modules) do_delete_modules=1 ;; -h|--help) usage 0 ;; --) shift break ;; esac shift done if [ -n "$do_add_modules" ]; then add_modules elif [ -n "$do_remove_modules" ]; then if [ -n "$do_delete_modules" ]; then remove_modules "noreplace" else remove_modules fi elif [ -n "$do_add_kernel" ]; then kernel=${1:-$(uname -r)} add_kernel $kernel elif [ -n "$do_remove_kernel" ]; then kernel=${1:-$(uname -r)} remove_kernel $kernel exit 0 else usage 1 fi ################################################################################ ###################### CLEANUP POST ADD/REMOVE MODULE/KERNEL ################### ################################################################################ # run depmod and dracut as needed for krel in ${!changed_modules_*}; do krel=${!krel} doit /sbin/depmod -ae -F /boot/System.map-$krel $krel done for krel in ${!changed_initramfs_*}; do krel=${!krel} if [ ! -n "$no_initramfs" ]; then check_initramfs $krel fi done
Close