forked from puppylinux-woof-CE/woof-CE
/
bb-create-symlinks
executable file
·81 lines (68 loc) · 3 KB
/
bb-create-symlinks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# * $applet_list is generated by busybox_static.petbuild
# after compiling a busybox compatible with the os arch
# * This script can be called from anywhere and will
# always work in the directory it is located in
# * First try to use actual applet list, otherwise fall back to $applet_list
#
# Arguments:
# $1 = busybox binary to use
#
applet_list='[ [[ arch ash awk basename beep blkdiscard blkid blockdev bootchartd cat chgrp chmod chown chroot chrt clear cp cpio cttyhack cut date dc dd depmod df diff dirname dmesg dos2unix du echo eject env expand expr factor fallocate false fbset fdisk find findfs flock free freeramdisk fuser guess_fstype gunzip gzip halt hdparm head hwclock init insmod iostat kill killall killall5 klogd less linux32 linux64 linuxrc ln loadfont loadkmap losetup ls lsmod lsof lspci lsscsi lsusb lzcat lzop lzopcat makedevs md5sum mdev mkdir mkfifo mkfs.vfat mknod mkswap mktemp modinfo modprobe more mount mountpoint mpstat mv nice nl nmeter nohup nproc nsenter partprobe pgrep pidof pivot_root pkill pmap poweroff printenv printf ps pwd raidautorun rdev readahead readlink realpath reboot reset rev rm rmdir rmmod sed seq setarch setconsole setfont sh sha1sum sha256sum sleep sort split stat stty swapoff swapon switch_root sync sysctl syslogd tac tail tar tee test time timeout top touch tr true tty ttysize uevent umount uname unexpand uniq unix2dos unlink unlzma unlzop unshare unxz uptime usleep vercmp watch wc which whoami xargs xz xzcat yes zcat '
sdir=$(dirname "$0")
if [ -x "$1" ] ; then
# busybox path has been specified, not in initrd
# ex: [chroot $NEWROOT] [$PATH_TO/]bb-create-symlinks /bin/busybox
echo "Creating symlinks to $1 in $sdir"
alist=$($1 --list)
[ "x$alist" = "x" ] && alist="$applet_list"
for a in $alist ; do
[ ! -e "$a" ] && ln -s $1 "$sdir/$a"
done
exit 0
fi
#------------------------------------------------------
# initrd
#------------------------------------------------------
if [ -f "$sdir/busybox" ] ; then
alist=$($sdir/busybox --list)
[ "x$alist" = "x" ] && alist="$applet_list"
for a in $alist ; do
[ ! -e "$a" ] && ln -s busybox "$sdir/$a"
done
fi
if [ -f "$sdir/exfatfsck" ] ; then
ln -s exfatfsck "$sdir/fsck.exfat"
fi
if [ -f "$sdir/mount.exfat-fuse" ] ; then
ln -s mount.exfat-fuse "$sdir/mount.exfat"
fi
if [ -f "$sdir/ntfs-3g" ] ; then
ln -s ntfs-3g "$sdir/mount.ntfs"
fi
if [ -f "$sdir/fsck.fat" ] ; then
ln -s fsck.fat "$sdir/fsck.vfat"
ln -s fsck.fat "$sdir/fsck.msdos"
fi
if [ -f "$sdir/e2fsck" ] ; then
ln -s e2fsck "$sdir/fsck.ext2"
ln -s e2fsck "$sdir/fsck.ext3"
ln -s e2fsck "$sdir/fsck.ext4"
ln -s e2fsck "$sdir/fsck.ext4dev"
fi
if [ -f "$sdir/nano" ] ; then
ln -sf nano "$sdir/pico"
ln -sf nano "$sdir/mp"
ln -sf nano "$sdir/ed"
fi
if [ -f "$sdir/kmod" ] ; then
rm -f $sdir/{depmod,insmod,lsmod,modinfo,modprobe,rmmod} 2>/dev/null
ln -sf kmod $sdir/depmod
ln -sf kmod $sdir/insmod
ln -sf kmod $sdir/lsmod
ln -sf kmod $sdir/modinfo
ln -sf kmod $sdir/modprobe
ln -sf kmod $sdir/rmmod
fi
### END ###