Browse Source

setup crontab, database; regen ssh keys and setup grub

tags/nilmdbuntu-1
Jim Paris 10 years ago
parent
commit
d35fae6d1d
3 changed files with 47 additions and 10 deletions
  1. +0
    -2
      TODO
  2. +33
    -1
      customize-inner.sh
  3. +14
    -7
      customize.sh

+ 0
- 2
TODO View File

@@ -1,9 +1,7 @@
- nilmdb crontab
- terminal, browser on desktop
- theme: style "Clearlooks", icons "elementary Xfce"
- nilmdb wallpaper, was "xubuntu-quantal.png"
- preseed username, password, login automatically?
- disable 13.04 upgrade notification?
- precreate database and streams
- maybe get rid of splash+quiet in installed image?
- try xubuntu 13.04

+ 33
- 1
customize-inner.sh View File

@@ -73,7 +73,8 @@ apt-get -y install \
subversion \
dlocate \
ack-grep \
mutt
mutt \
openssh-server

# Set up timezone to America/New_York for the live CD
echo America/New_York > /etc/timezone
@@ -164,6 +165,22 @@ keep = 1y
decimated = false
EOF

# Set up crontab
cat > /home/nilmdb/crontab <<"EOF"
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Run capture and processing scripts every 5 minutes
*/5 * * * * chronic /home/nilmdb/capture.sh
*/5 * * * * chronic /home/nilmdb/process.sh

# Try to run nilmdb-fsck on boot. It should hopefully run before
# apache opens the database, and apache will return errors to clients
# until nilmdb-fsck is done.
@reboot chronic nilmdb-fsck --fix --no-data /home/nilmdb/db
EOF
crontab -u nilmdb /home/nilmdb/crontab

# Fix permissions
chown -R nilmdb:nilmdb /home/nilmdb
chmod +x /home/nilmdb/{capture,process}.sh
@@ -188,3 +205,18 @@ done

# fix up all permissions in git dir, so nilmdb user can play with it later
chown -R nilmdb:nilmdb /home/nilmdb/git

# Create the initial database and streams by running the standalone
# server as nilmdb, making the right nilmtool calls, and killing it.
sudo -i -u nilmdb nilmdb-server -a 127.0.0.1 -p 18646 &
SERVER=$!
sleep 1
nilmtool -u http://127.0.0.1:18646/ destroy -R "/data/*" || true
nilmtool -u http://127.0.0.1:18646/ create /data/raw uint16_6
nilmtool -u http://127.0.0.1:18646/ create /data/sinefit float32_3
nilmtool -u http://127.0.0.1:18646/ create /data/prep-a float32_8
nilmtool -u http://127.0.0.1:18646/ create /data/prep-b float32_8
nilmtool -u http://127.0.0.1:18646/ create /data/prep-c float32_8
kill $!
sleep 1
kill -9 $! || true

+ 14
- 7
customize.sh View File

@@ -5,7 +5,7 @@ set -e
set -x

# Customize the outer ISO image
perl -p -i -e \
sed -i -e \
"s/DISKNAME.*/DISKNAME NilmDBuntu $VERSION by Jim Paris/" \
${ISO}/README.diskdefines

@@ -13,16 +13,23 @@ perl -p -i -e \
# out the distro name in dialogs, and I think casper might use it too
echo "NilmDBuntu $VERSION by Jim Paris" > ${ISO}/.disk/info

# Include openssh server at install time. Can't include it in the
# image, because then we'd share keys on all machines, I think.
# Set up preseed file
cp ${ISO}/preseed/xubuntu.seed ${ISO}/preseed/nilmdbuntu.seed
cat >> ${ISO}/preseed/nilmdbuntu.seed <<EOF
d-i pkgsel/include string openssh-server
cat >> ${ISO}/preseed/nilmdbuntu.seed <<"EOF"
# Late commands:
# - Regenerate SSH host keys
# - Remove "quiet splash" from grub command line
d-i preseed/late_command string \
in-target rm /etc/ssh/ssh_host_*; \
in-target dpkg-reconfigure openssh-server; \
in-target sed -i 's/quiet splash//g' /etc/default/grub; \
in-target update-grub; \
echo "done"
EOF

# Rename Xubuntu to NilmDBuntu in boot scripts; also changes
# preseed file to the custom one
perl -p -i \
sed -i \
-e "s/Xubuntu/NilmDBuntu/g;" \
-e "s/Kubuntu/NilmDBuntu/g;" \
-e "s/Ubuntu/NilmDBuntu/g;" \
@@ -33,7 +40,7 @@ perl -p -i \

# Remove quiet and splash from boot command lines. Easier than a
# custom plymouth theme and it's helpful.
perl -p -i -e "s/ quiet splash//g;" \
sed -i -e "s/ quiet splash//g;" \
${ISO}/isolinux/txt.cfg ${ISO}/boot/grub/{grub,loopback}.cfg

# Run the customize-inner.sh script inside the chroot


Loading…
Cancel
Save