fakeroot 可以用来模拟 root 权限,以便建立特定权限与档案拥有者的压缩文件案(tar, ar, .deb 等)。透过 LD_PRELOAD 的 dynamic loader 功能,用户不必实际拥有 root 权限。
生成系统文件时使用
echo "make squash image ..."
echo "${TOOLDIR}/makedevs -d device_table.txt ${CUDIR}/fs" > squash_input
echo "${TOOLDIR}/mksquashfs ${FS_DIR} ${2} -all-root -le -noappend" >> squash_input
echo "exit" >> squash_input
#chmod +x squash_input
#./squash_input
fakeroot<squash_input > /dev/null
rm squash_input
本文介绍如何利用fakeroot工具来模拟root权限进行系统文件的生成过程,特别针对squashfs格式的文件制作。通过fakeroot,普通用户也能完成通常需要管理员权限才能执行的任务。

1万+

被折叠的 条评论
为什么被折叠?



