Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import some other misc patches from GRNET #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,25 @@ setup_console() {
esac
}

filesystem_check() {
local target=$1
if [ -z "$target" ] ; then
log_error "target not set for filesystem_check"
exit 1
fi

get_os $target

case "${OPERATING_SYSTEM}" in
fedora|centos|redhat)
# we have to force a filesystem relabeling for SELinux after messing
# around with the filesystem in fedora
echo "Enforce an automatic relabeling in the initial boot process..."
touch $target/.autorelabel
;;
esac
}

cleanup() {
if [ ${#CLEANUP[*]} -gt 0 ]; then
LAST_ELEMENT=$((${#CLEANUP[*]}-1))
Expand Down
2 changes: 2 additions & 0 deletions create
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ if [ "$CDINSTALL" = "no" ] ; then
setup_console $TARGET
fi

filesystem_check $TARGET

RUN_PARTS=`which run-parts`

if [ -n "$RUN_PARTS" -a -n "$CUSTOMIZE_DIR" -a -d "$CUSTOMIZE_DIR" ]; then
Expand Down
28 changes: 28 additions & 0 deletions example/hooks/cron_randomize
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

#
# Copyright (C) 2011 Greek Research and Technology Network
#

set -e

. common.sh

debug set -x

trap cleanup EXIT

n=$RANDOM
min=$(( n %= 30 ))

echo "SHELL=/bin/sh" > ${TARGET}/etc/crontab
echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> ${TARGET}/etc/crontab
printf "\n" >> ${TARGET}/etc/crontab
echo "# m h dom mon dow user command" >> ${TARGET}/etc/crontab
echo "$min * * * * root cd / && run-parts --report cron.hourly" >> ${TARGET}/etc/crontab
echo "$((min + 7)) 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report cron.daily )" >> ${TARGET}/etc/crontab
echo "$((min + 13)) 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report cron.weekly )" >> ${TARGET}/etc/crontab
echo "$((min + 24)) 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report cron.monthly )" >> ${TARGET}/etc/crontab

trap - EXIT
exit 0