Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added support for ubuntu/debian and gentoo

  • Loading branch information...
commit 8c74dc78edb48d3d37d9cc71899417d46cddd43f 1 parent a14e395
graysky authored
6 CHANGELOG
View
@@ -1,9 +1,13 @@
+v5.16
+11-Feb-2013
+Added support for ubuntu/debian and gentoo.
+
v5.15
11-Feb-2013
Updated debian init script.
v5.14
-70-Feb-2013
+10-Feb-2013
Update to man page.
v5.13
24 README-for_other_distros
View
@@ -1,9 +1,6 @@
NAME
profile-sync-daemon - Symlinks and syncs browser profile dirs to RAM thus reducing HDD/SDD calls and speeding-up browsers.
-SYNOPSIS
-systemctl [options] psd.service
-
DESCRIPTION
Profile-sync-daemon (psd) is a tiny pseudo-daemon designed to manage your browser profile(s) in tmpfs and to periodically sync back to the physical disc (HDD/SSD). This is accomplished via a symlinking step and an innovative use of rsync to maintain back-up and synchronization between the two. One of the major design goals of psd is a completely transparent user experience.
@@ -21,7 +18,7 @@ User managed settings are defined in /etc/psd.conf.
o At a minimum, define which user(s) will have their profiles managed by psd and note that at least one user must be defined.
o Optionally uncomment and define which browsers are to be managed in the BROWSERS array. Note that the default is all browsers unless otherwise defined.
- o Optionally redefine the location of your distro's tmpfs. Do this in the VOLATILE variable. Note that for Arch Linux, the default value of "/tmp" should work just fine.
+ o Optionally redefine the location of your distro's tmpfs. Do this in the VOLATILE variable.
PARSE MODE
The parse option can be called to show users exactly what psd will do based on the /etc/psd.conf entered. Call it like so:
@@ -33,8 +30,8 @@ As you will see in the output and as stated above, if no specific browser or sub
GENERAL USAGE
Do NOT call /usr/bin/profile-sync-daemon to sync or to unsync directly! Instead, use your distro's init system. The initial synchronization will occur when the daemon starts. Additionally, cron (if running on your system) will call it to sync or update once per hour. Finally, psd will sync back a final time when it is called to stop.
-FOR SYSTEMD USERS
-This officially supported method provides a systemd service file which should be used to interact with psd (/usr/lib/systemd/system/psd.service):
+SYSTEMD
+Example distro include: Arch Linux, Chakra, and Fedora. The officially supported method provides a systemd service file which should be used to interact with psd (/usr/lib/systemd/system/psd.service):
# systemctl [option] psd.service
@@ -45,8 +42,14 @@ Available options:
disable Remove daemon from the list of autostart daemons.
OTHER INITSCRIPTS
-Other init scripts may be used to manage the deamon, but they are unsupported by the author.
+Other init scripts may be used to manage the deamon, but they are unsupported by the author.
+ o Debian/Ubuntu, a user-contributed init.d file suitable for use on both Debian and Ubuntu is included (psd.debian.init.example).
+ o Gentoo users have a similar developer-contributed init.d script (psd.rc.gentoo.example).
+ # /etc/init.d/psd [option]
+ start Turn on daemon; make symlinks and actively manage targets in tmpfs.
+ stop Turn off daemon; remove symlinks and rotate tmpfs data back to disc.
+
SUPPORTED BROWSERS
Currently, the following browsers are auto-detected and managed:
o Chromium
@@ -83,13 +86,6 @@ The following is an example of a BAD profile that will not pass the test. You ca
SUPPORTED DISTROS
At this time, the only officially supported distro package is for Arch Linux and can be downloaded and built from the AUR at the following URL: https://aur.archlinux.org/packages/profile-sync-daemon/
-UNSUPPORTED DISTROS
-Psd is a simple bash script and should therefore run on any Linux distro. Below is a list of distros known to package psd, and a link to download their respective packages. As noted above, these are unsupported by the author due to their own, unique init scripts:
-
- o Chakra Linux via CCR Package: http://chakra-linux.org/ccr/packages.php?ID=3388
- o Gentoo via Ebuild: http://packages.gentoo.org/package/www-misc/profile-sync-daemon
- o Ubuntu package: http://link.coming.soon
-
CONTRIBUTE
Should you wish to contribute to this code, please fork and send a pull request. Source is freely available on github: https://github.com/graysky2/profile-sync-daemon
6 profile-sync-daemon
View
@@ -2,7 +2,7 @@
# By graysky <graysky AT archlinux DOT us>
# Inspired by some code originally written by Colin Verot
export BLD="\e[01m" RED="\e[01;31m" GRN="\e[01;32m" YLW="\e[01;33m" NRM="\e[00m"
-VERS="5.15"
+VERS="5.16"
if [[ ! -f /etc/psd.conf ]]; then
echo "Cannot find /etc/psd.conf so bailing. Reinstall package to use Profile-sync-daemon." # nothing to do if there is no conf file
@@ -25,7 +25,7 @@ DAEMON_FILE=${DAEMON_FILE:-"/run/psd"} # make it overrideable from the commandli
dep_check() {
# Although the package manager should handle these deps, this function is a sanity check for users.
command -v rsync >/dev/null 2>&1 || { echo "I require rsync but it's not installed. Aborting." >&2; exit 1; }
- command -v gawk >/dev/null 2>&1 || { echo "I require gawk but it's not installed. Aborting." >&2; exit 1; }
+ command -v awk >/dev/null 2>&1 || { echo "I require awk but it's not installed. Aborting." >&2; exit 1; }
}
root_check() {
@@ -196,7 +196,7 @@ parse_conf_file() {
for item in ${DIRArr[@]}; do
DIR="$item"
[[ "$browser" = "firefox" ]] || [[ "$browser" = "heftig-aurora" ]] && suffix="-${item##*/}" || suffix=
- psize=$(du -Lh --max-depth=0 $DIR 2>/dev/null | gawk '{ print $1 }') # profile dir size
+ psize=$(du -Lh --max-depth=0 $DIR 2>/dev/null | awk '{ print $1 }') # profile dir size
if [[ -d "$DIR" ]]; then
echo -en " ${BLD}browser/psname:"
echo -e "$(tput cr)$(tput cuf 17) $browser/$PSNAME"${NRM}
6 psd.conf
View
@@ -32,5 +32,9 @@ USERS=""
# Define where browser profiles will reside in tmpfs
# This location must be mounted to tmpfs and MUST have permissions of 777
# Use NO trailing backslash!
-# If running a standard ARCH install the following default is fine
+#
+# Suggested locations based on distro defaults:
+# Arch Linux/Chakra and Gentoo users can leave this commented out
+# Debian users should use a setting of "/dev/shm"
+# Ubuntu users should use a setting of "/run/shm"
#VOLATILE="/tmp"
0  psd.debian.init.example 100755 → 100644
View
File mode changed
45 psd.manpage
View
@@ -1,17 +1,8 @@
.\" Text automatically generated by txt2man
-.TH profile-sync-daemon 1 "09 February 2013" "" ""
+.TH profile-sync-daemon 1 "11 February 2013" "" ""
.SH NAME
\fBprofile-sync-daemon \fP- Symlinks and syncs browser profile dirs to RAM thus reducing HDD/SDD calls and speeding-up browsers.
\fB
-.SH SYNOPSIS
-.nf
-.fam C
-\fBsystemctl\fP [\fIoptions\fP] psd.service
-
-.fam T
-.fi
-.fam T
-.fi
.SH DESCRIPTION
Profile-sync-daemon (psd) is a tiny pseudo-daemon designed to manage your browser \fBprofile\fP(s) in tmpfs and to periodically sync back to the physical disc (HDD/SSD). This is accomplished via a symlinking step and an innovative use of rsync to maintain back-up and synchronization between the two. One of the major design goals of psd is a completely transparent user experience.
.PP
@@ -34,7 +25,7 @@ At a minimum, define which \fBuser\fP(s) will have their profiles managed by psd
.IP \(bu 3
Optionally uncomment and define which browsers are to be managed in the BROWSERS array. Note that the default is all browsers unless otherwise defined.
.IP \(bu 3
-Optionally redefine the location of your distro's tmpfs. Do this in the VOLATILE variable. Note that for Arch Linux, the default value of "/tmp" should work just fine.
+Optionally redefine the location of your distro's tmpfs. Do this in the VOLATILE variable.
.SH PARSE MODE
The parse option can be called to show users exactly what psd will do based on the /etc/psd.conf entered. Call it like so:
.PP
@@ -47,8 +38,8 @@ The parse option can be called to show users exactly what psd will do based on t
As you will see in the output and as stated above, if no specific browser or subset of browsers are defined in the BROWSERS array, psd will sync ALL supported profiles that it finds for the given \fBuser\fP(s).
.SH GENERAL USAGE
Do NOT call /usr/bin/profile-sync-daemon to sync or to unsync directly! Instead, use your distro's init system. The initial synchronization will occur when the daemon starts. Additionally, cron (if running on your system) will call it to sync or update once per hour. Finally, psd will sync back a final time when it is called to stop.
-.SH FOR SYSTEMD USERS
-This officially supported method provides a systemd service file which should be used to interact with psd (/usr/lib/systemd/system/psd.service):
+.SH SYSTEMD
+Example distro include: Arch Linux, Chakra, and Fedora. The officially supported method provides a systemd service file which should be used to interact with psd (/usr/lib/systemd/system/psd.service):
.PP
.nf
.fam C
@@ -56,7 +47,7 @@ This officially supported method provides a systemd service file which should be
.fam T
.fi
-Available \fIoptions\fP:
+Available options:
.RS
.TP
.B
@@ -75,7 +66,22 @@ Autostart daemon when system comes up.
disable
Remove daemon from the list of autostart daemons.
.SH OTHER INITSCRIPTS
-Other init scripts may be used to manage the deamon, but they are unsupported by the author.
+Other init scripts may be used to manage the deamon, but they are unsupported by the author.
+.RS
+.IP \(bu 3
+Debian/Ubuntu, a user-contributed init.d file suitable for use on both Debian and Ubuntu is included (psd.debian.init.example).
+.IP \(bu 3
+Gentoo users have a similar developer-contributed init.d script (psd.rc.gentoo.example).
+.PP
+# /etc/init.d/psd [option]
+.TP
+.B
+start
+Turn on daemon; make symlinks and actively manage targets in tmpfs.
+.TP
+.B
+stop
+Turn off daemon; remove symlinks and rotate tmpfs data back to disc.
.SH SUPPORTED BROWSERS
Currently, the following browsers are auto-detected and managed:
.RS
@@ -124,15 +130,6 @@ The following is an example of a BAD profile that will not pass the test. You ca
.fi
.SH SUPPORTED DISTROS
At this time, the only officially supported distro package is for Arch Linux and can be downloaded and built from the AUR at the following URL: https://aur.archlinux.org/packages/profile-sync-daemon/
-.SH UNSUPPORTED DISTROS
-Psd is a simple bash script and should therefore run on any Linux distro. Below is a list of distros known to package psd, and a link to download their respective packages. As noted above, these are unsupported by the author due to their own, unique init scripts:
-.RS
-.IP \(bu 3
-Chakra Linux via CCR Package: http://chakra-linux.org/ccr/packages.php?ID=3388
-.IP \(bu 3
-Gentoo via Ebuild: http://packages.gentoo.org/package/www-misc/profile-sync-daemon
-.IP \(bu 3
-Ubuntu package: http://link.coming.soon
.SH CONTRIBUTE
Should you wish to contribute to this code, please fork and send a pull request. Source is freely available on github: https://github.com/graysky2/profile-sync-daemon
.SH BUGS
73 psd.rc.gentoo.example
View
@@ -0,0 +1,73 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Webbrowser profile syncing"
+extra_commands="debug resync"
+
+wait(){
+ for pid in "$@"; do
+ while kill -s 0 "$pid" 2>/dev/null; do
+ sleep 0.5
+ done
+ done
+}
+
+start() {
+ ebegin "Starting Profile-Sync-Daemon"
+ if [ -z "$USERS" ]; then
+ eerror "Define at least one user in /etc/conf.d/psd"
+ return 1
+ fi
+
+ if [ ! -f "$PIDFILE" ]; then
+ /usr/bin/profile-sync-daemon check || return 1
+ fi
+
+ start-stop-daemon \
+ --start \
+ --pidfile "${PIDFILE}" \
+ --make-pidfile \
+ --background \
+ --exec /usr/bin/profile-sync-daemon -- sync
+
+ wait $(cat "${PIDFILE}")
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Profile-Sync-Daemon"
+ if [ ! -f "$PIDFILE" ]; then
+ eerror "Profile-Sync-Daemon is not running, nothing to stop!"
+ return 1
+ else
+ /usr/bin/profile-sync-daemon unsync
+ rm -f "${PIDFILE}"
+ fi
+ eend $?
+}
+
+debug() {
+ /usr/bin/profile-sync-daemon debug
+}
+
+resync() {
+ ebegin "Syncing browser profiles in tmpfs to physical disc"
+ if [ ! -f "$PIDFILE" ]; then
+ eerror "Profile-Sync-Daemon is not running... cannot sync!"
+ return 1
+ else
+ /usr/bin/profile-sync-daemon resync
+ fi
+ eend $?
+}
+
+status() {
+ if [ ! -f "$PIDFILE" ]; then
+ eerror "Profile-Sync-Daemon is not running"
+ else
+ einfo "Profile-Sync-Daemon is running"
+ fi
+ eend $?
+}
Please sign in to comment.
Something went wrong with that request. Please try again.