Browse Source

add rootfs-chown package

Signed-off-by: weishanshan1084 <weishanshan1084@phytium.com.cn>
pull/26/head
weishanshan1084 6 months ago
parent
commit
1cd28bcc2b
  1. 1
      package/Config.in
  2. 2
      package/rootfs-chown/Config.in
  3. 23
      package/rootfs-chown/rootfs-chown.mk
  4. 54
      package/rootfs-chown/src/S60rootfs-chown
  5. 11
      package/rootfs-chown/src/systemd-rootfs-chown.service

1
package/Config.in

@ -253,6 +253,7 @@ menu "Filesystem and flash utilities"
source "package/xfsprogs/Config.in"
source "package/zerofree/Config.in"
source "package/zfs/Config.in"
source "package/rootfs-chown/Config.in"
endmenu
menu "Fonts, cursors, icons, sounds and themes"

2
package/rootfs-chown/Config.in

@ -0,0 +1,2 @@
config BR2_PACKAGE_ROOTFS_CHOWN
bool "rootfs_chown"

23
package/rootfs-chown/rootfs-chown.mk

@ -0,0 +1,23 @@
################################################################################
#
# rootfs-chown
#
################################################################################
ROOTFS_CHOWN_VERSION = 0.1
ROOTFS_CHOWN_SITE = package/rootfs-chown/src
ROOTFS_CHOWN_SITE_METHOD = local
ROOTFS_CHOWN_INSTALL_TARGET_CMDS = YES
define ROOTFS_CHOWN_INSTALL_INIT_SYSV
$(INSTALL) -m 755 -D $(@D)/S60rootfs-chown $(TARGET_DIR)/etc/init.d/
endef
define ROOTFS_CHOWN_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/etc/init.d/
mkdir -p $(TARGET_DIR)/lib/systemd/system/
$(INSTALL) -m 755 -D $(@D)/S60rootfs-chown $(TARGET_DIR)/etc/init.d/
$(INSTALL) -m 644 -D $(@D)/systemd-rootfs-chown.service $(TARGET_DIR)/lib/systemd/system/
endef
$(eval $(generic-package))

54
package/rootfs-chown/src/S60rootfs-chown

@ -0,0 +1,54 @@
#!/bin/sh
#
# rootfs-chown Starts rootfs-chown.
#
rootfs_chown() {
printf "\t chown folder in the rootfs: "
[ -d /var/cache/man ] && chown -R man:root /var/cache/man
[ -d /var/lib/sddm ] && chown -R sddm:sddm /var/lib/sddm
if [ -d /var/lib/lightdm ]; then
chown -R lightdm:lightdm /var/lib/lightdm || true
chmod 0750 /var/lib/lightdm
fi
chown -R user:user /home/user
if [ $? -eq 0 ]
then
echo "OK"
else
echo "Failed"
exit 1
fi
echo 0
}
start() {
printf "Starting rootfs-chown: \n"
rootfs_chown
}
stop() {
printf "Stopping rootfs-chown: "
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

11
package/rootfs-chown/src/systemd-rootfs-chown.service

@ -0,0 +1,11 @@
[Unit]
Description=chown folder
DefaultDependencies=no
After=getty.target
[Service]
Type=oneshot
ExecStart=/etc/init.d/S60rootfs-chown start
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save