Browse Source

Add scripts for Profile-sync-daemon

rocket-config
mid-kid 8 years ago
parent
commit
2f2147e591
  1. 2
      doinst.sh
  2. 5
      etc/cron.hourly/psd
  3. 5
      etc/rc.d/rc.6
  4. 5
      etc/rc.d/rc.M
  5. 73
      etc/rc.d/rc.psd
  6. 17
      readme.txt
  7. 2
      rocket-config.SlackBuild

2
doinst.sh

@ -18,7 +18,7 @@ config() {
rmconfig() {
CFG="$1"
ORIGMD5="$2"
if [ -r $CFG ] && [ "`cat $CFG | md5sum`" = "$ORIGMD5 -" ]; then
if [ -r $CFG ] && [ "$(cat $CFG | md5sum)" = "$ORIGMD5 -" ]; then
mv $CFG $CFG.orig
fi
}

5
etc/cron.hourly/psd

@ -0,0 +1,5 @@
#!/bin/sh
# Tell Profile-sync-daemon to resync
if [ -x /etc/rc.d/rc.psd ]; then
/etc/rc.d/rc.psd start
fi

5
etc/rc.d/rc.6

@ -78,6 +78,11 @@ if [ -x /etc/rc.d/rc.local_shutdown ]; then
/etc/rc.d/rc.local_shutdown stop
fi
# Stop Profile-sync-daemon:
if [ -x /etc/rc.d/rc.psd ]; then
/etc/rc.d/rc.psd stop
fi
# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
/etc/rc.d/rc.httpd stop

5
etc/rc.d/rc.M

@ -380,6 +380,11 @@ if [ -x /etc/rc.d/rc.sysvinit ]; then
. /etc/rc.d/rc.sysvinit
fi
# Start Profile-sync-daemon:
if [ -x /etc/rc.d/rc.psd ]; then
/etc/rc.d/rc.psd start
fi
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
. /etc/rc.d/rc.local

73
etc/rc.d/rc.psd

@ -0,0 +1,73 @@
#!/bin/sh
#
# /etc/rc.d/rc.psd
#
# Start/stop profile-sync-daemon.
#
# This script enables and disables profile-sync-daemon for selected users.
# You can either define users in the $USERS array,
# or have this script scan for them and save them in $USERS_CACHE.
USERS=""
USERS_CACHE="/run/psd-users.cache"
scan_users() {
rm -f "$USERS_CACHE"
for user in $(getent passwd | cut -d: -f1); do
group="$(getent passwd $user | cut -d: -f4)"
home="$(getent passwd $user | cut -d: -f6)"
shell="$(getent passwd $user | cut -d: -f7)"
if [ "$group" != "0" -a "$home" -a "$home" != "/" -a "$(grep $shell /etc/shells)" ]; then
config="$(su - $user -c 'echo $XDG_CONFIG_HOME')"
[ ! "$config" ] && config="$home/.config"
if [ -f "$config/psd/psd.conf" ]; then
echo "$user" >> "$USERS_CACHE"
fi
fi
done
}
get_users() {
# If $USERS is empty, try to create it based on what users have an existing $XDG_CONFIG_HOME/psd/psd.conf
if [ ! "$USERS" ]; then
if [ ! -f "$USERS_CACHE" ]; then
scan_users
fi
cat "$USERS_CACHE"
else
echo "$USERS"
fi
}
start_psd() {
if [ -x /usr/bin/psd ]; then
echo "Starting/Resyncing Profile-sync-daemon..."
for user in $(get_users); do
su - $user -c 'psd resync'
done &
fi
}
stop_psd() {
if [ -x /usr/bin/psd ]; then
echo "Stoppping Profile-sync-daemon..."
for user in $(get_users); do
su - $user -c 'psd unsync'
done
fi
}
case "$1" in
'start')
start_psd
;;
'stop')
stop_psd
;;
'scan_users')
scan_users
;;
*)
echo "Usage: $0 start|stop|scan_users"
esac

17
readme.txt

@ -8,12 +8,15 @@ Changes:
/etc/rc.d/rc.M:
- Added entry for dhcpcd
- Added entry for psd
/etc/rc.d/rc.S:
- Removed useless sleep before mounting local filesystems.
- Removed useless sleep before mounting local filesystems
- Create /run/user
/etc/rc.d/rc.6:
- Added saving alsa sound state if /etc/rc.d/rc.alsa is executable.
- Added saving alsa sound state if /etc/rc.d/rc.alsa is executable
- Added entry for psd
/etc/rc.d/rc.dhcpcd:
- Just run dhcpcd on boot
@ -24,6 +27,12 @@ Changes:
/etc/profile:
- Added sbin paths to the PATH for all users
/etc/profile.d/xdg-runtime-dir.sh:
- Create/Set XDG_RUNTIME_DIR properly
/etc/sysctl.d/swappiness.conf:
- Set vm.swappiness to 0
/etc/dhcpcd.conf:
- Removed nohook for wpa_supplicant, to run it on every wireless interface
@ -31,7 +40,7 @@ Changes:
- Uncommented all default NTP servers.
/etc/slackpkg/blacklist:
- A list of the packages I usually remove from the base install. It's not replaced on install and completely optional.
- A list of the packages I usually remove from the base install. It's not replaced on install and completely optional
/etc/X11/xinit/xinitrc.i3:
- Added xinitrc file for the i3 window system.
- Added xinitrc file for the i3 window system

2
rocket-config.SlackBuild

@ -30,7 +30,7 @@ find $CWD/etc -type f ! -name '*.orig' -printf '%P\n' | while read config; do
done
# Set some special permissions
chmod 755 $PKG/etc/rc.d/rc.* $PKG/etc/X11/xinit/* $PKG/etc/profile.d/*
chmod 755 $PKG/etc/rc.d/rc.* $PKG/etc/X11/xinit/* $PKG/etc/profile.d/* $PKG/etc/cron.*/*
cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz

Loading…
Cancel
Save