+#################### CLIENT
+install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
+install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
+
+#################### SERVER
+install -d $RPM_BUILD_ROOT/usr/share/%{name}
+install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
+install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
+install -d $RPM_BUILD_ROOT/var/lib/%{name}
+install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
+install -d $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
+
+install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
+
+echo " * Installing core scripts"
+rsync -a --exclude www --exclude archive-pdb --exclude .svn --exclude CVS \
+ ./ $RPM_BUILD_ROOT/usr/share/%{name}/
+
+echo " * Installing web pages"
+rsync -a www/ $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
+
+echo " * Installing cron job for automated polling"
+install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
+echo " * TODO: Setting up Monitor account in local MyPLC"
+# TODO:
+
+install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
+install -d -D -m 755 monitor $RPM_BUILD_ROOT/%{python_sitearch}/monitor
+# TODO: need a much better way to do this.
+rsync -a monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
+#for file in __init__.py database.py config.py ; do
+# install -D -m 644 monitor/$file $RPM_BUILD_ROOT/%{python_sitearch}/monitor/$file
+#done
+rsync -a pcucontrol/ $RPM_BUILD_ROOT/%{python_sitearch}/pcucontrol/
+install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
+
+touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
+chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
+
+#install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
+#cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py