diff --git a/doinst.sh b/doinst.sh index 3cde572..a725ad2 100644 --- a/doinst.sh +++ b/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 } diff --git a/etc/cron.hourly/psd b/etc/cron.hourly/psd new file mode 100644 index 0000000..ed4a176 --- /dev/null +++ b/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 diff --git a/etc/rc.d/rc.6 b/etc/rc.d/rc.6 index dd13461..d29c210 100644 --- a/etc/rc.d/rc.6 +++ b/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 diff --git a/etc/rc.d/rc.M b/etc/rc.d/rc.M index bfc71d2..40c2e5f 100644 --- a/etc/rc.d/rc.M +++ b/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 diff --git a/etc/rc.d/rc.psd b/etc/rc.d/rc.psd new file mode 100644 index 0000000..2303b87 --- /dev/null +++ b/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 diff --git a/readme.txt b/readme.txt index 6bc5c40..294179f 100644 --- a/readme.txt +++ b/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 diff --git a/rocket-config.SlackBuild b/rocket-config.SlackBuild index b9c8cb0..7efb812 100755 --- a/rocket-config.SlackBuild +++ b/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