weishanshan1084
6 months ago
5 changed files with 91 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||
config BR2_PACKAGE_ROOTFS_CHOWN |
|||
bool "rootfs_chown" |
@ -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)) |
@ -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 $? |
@ -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…
Reference in new issue