aboutsummaryrefslogtreecommitdiffstats
path: root/classes/usr-merge.bbclass
blob: 9f471793ca4bcdeab64fbe14624434e583d7470e (plain)
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
LICENSE = "GPLv2"

# http://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge
# /bin → /usr/bin
# /sbin → /usr/sbin
# /lib → /usr/lib
# /lib64 → /usr/lib64

usr_merge() {
	#
	# TO DO: Edit kernel modules to be installed in usr lib and
	#        remove the workaround below
	#
	echo "usr-merge: moving modules in /usr/lib ..."
	mkdir -p $INSTALL_ROOTFS_RPM/usr/lib
	mv $INSTALL_ROOTFS_RPM/lib/modules $INSTALL_ROOTFS_RPM/usr/lib
	rmdir $INSTALL_ROOTFS_RPM/lib/

	echo "usr-merge: Creating symlinks for /usr merge stage ..."
	if [ ! -d $INSTALL_ROOTFS_RPM/sbin -a -d $INSTALL_ROOTFS_RPM/usr/sbin ]; then
		echo "usr-merge: Create simlink /sbin -> /usr/sbin ..."
		ln -sf ./usr/sbin $INSTALL_ROOTFS_RPM/sbin
	else
		echo "usr-merge: /sbin is already created. Can't create symlink for usr merge"
		exit 1
	fi

	if [ ! -d $INSTALL_ROOTFS_RPM/bin -a -d $INSTALL_ROOTFS_RPM/usr/bin ]; then
		echo "usr-merge: Create simlink /bin -> /usr/bin ..."
		ln -sf ./usr/bin $INSTALL_ROOTFS_RPM/bin
	else
		echo "usr-merge: /bin is already created. Can't create symlink for usr merge"
		exit 1
	fi

	if [ ! -d $INSTALL_ROOTFS_RPM/lib -a -d $INSTALL_ROOTFS_RPM/usr/lib ]; then
		echo "usr-merge: Create simlink /lib -> /usr/lib ..."
		ln -sf ./usr/lib $INSTALL_ROOTFS_RPM/lib
	else
		echo "usr-merge: /lib is already created. Can't create symlink for usr merge"
		exit 1
	fi

	#
	# /lib64 is optional
	#
	if [ ! -d $INSTALL_ROOTFS_RPM/lib64 -a -d $INSTALL_ROOTFS_RPM/usr/lib64 ]; then
		echo "usr-merge: Create simlink /lib64 -> /usr/lib64 ..."
		ln -sf ./usr/lib64 $INSTALL_ROOTFS_RPM/lib64
	fi
}