function hydra_deploy_mkdirs {
# Saner defaults
$DEPLOY_COMMAND mkdir -p /etc/puppet/keys
- $DEPLOY_COMMAND chown -R root. /etc/puppet
+ $DEPLOY_COMMAND chown -R root: /etc/puppet
$DEPLOY_COMMAND chmod -R 640 /etc/puppet
}
tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%m%d%H%M`.log
# Fix ssl folder ownership
- $SUDO chown -R `whoami`. $HYDRA_FOLDER/puppet/ssl
+ $SUDO chown -R `whoami`: $HYDRA_FOLDER/puppet/ssl
# Import keys if needed
if ! $SUDO test -f /root/.ssh/id_rsa || \
$HYDRA_CONNECT $hostname <<EOF
sudo mkdir -p /etc/ssl/private
sudo mkdir -p /etc/ssl/certs
- sudo chown root.ssl-cert /etc/ssl/private
- sudo chown root.ssl-cert /etc/ssl/certs
+ sudo chown root:ssl-cert /etc/ssl/private
+ sudo chown root:ssl-cert /etc/ssl/certs
sudo chmod 750 /etc/ssl/private
sudo chmod 755 /etc/ssl/certs
EOF
$HYDRA_CONNECT $hostname <<EOF
sudo touch /etc/ssl/certs/$cert
- sudo chown root.ssl-cert /etc/ssl/certs/$cert
+ sudo chown root:ssl-cert /etc/ssl/certs/$cert
sudo chmod 644 /etc/ssl/certs/$cert
sudo touch /etc/ssl/private/$priv
- sudo chown root.ssl-cert /etc/ssl/private/$priv
+ sudo chown root:ssl-cert /etc/ssl/private/$priv
sudo chmod 640 /etc/ssl/private/$priv
EOF
echo "Creating folder structure at $hostname:/root/.ssh..."
$HYDRA_CONNECT $hostname <<EOF
sudo mkdir -p /root/.ssh
- sudo chown root.root /root/.ssh
+ sudo chown root:root /root/.ssh
sudo chmod 700 /root/.ssh
sudo touch /root/.ssh/id_rsa
sudo touch /root/.ssh/id_rsa.pub
echo "Creating folder structure at $hostname:/root/.ssh..."
sudo mkdir -p /root/.ssh
- sudo chown root.root /root/.ssh
+ sudo chown root:root /root/.ssh
sudo chmod 700 /root/.ssh
sudo touch /root/.ssh/id_rsa
sudo touch /root/.ssh/id_rsa.pub
$HYDRA_CONNECT $hostname <<EOF
sudo rm -rf /root/.borg
sudo mkdir -p /root/.config/borg/hydra
- sudo chown root.root /root/.config/borg
- sudo chown root.root /root/.config/borg/hydra
+ sudo chown root:root /root/.config/borg
+ sudo chown root:root /root/.config/borg/hydra
sudo chmod 700 /root/.config/borg
sudo chmod 700 /root/.config/borg/hydra
sudo touch /root/.config/borg/hydra/key
echo "Creating folder structure at $hostname:/root/.config/borg..."
sudo mkdir -p /root/.config/borg/hydra
- sudo chown root.root /root/.config/borg
- sudo chown root.root /root/.config/borg/hydra
+ sudo chown root:root /root/.config/borg
+ sudo chown root:root /root/.config/borg/hydra
sudo chmod 700 /root/.config/borg
sudo chmod 700 /root/.config/borg/hydra
sudo touch /root/.config/borg/hydra/key
#cp -a $RESTOREDIR/$SERVICE_DIR $SERVICE_DIR
#
# Fix permissions.
-#chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+#chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
rsync -av --delete $RESTOREDIR/$SERVICE_DIR/ $SERVICE_DIR/
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
cp -a $RESTOREDIR/$SERVICE_DIR $SERVICE_DIR
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
# Kick config.
su $SERVICE_USER -c "gl-setup"
done
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
rsync -av $RESTOREDIR/$DATABASE_DIR/ $DATABASE_DIR/
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
rsync -av --delete $RESTOREDIR/$SERVICE_DIR/ $SERVICE_DIR/
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
cp -a $RESTOREDIR/$SERVICE_DIR $SERVICE_DIR
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
rsync -av --delete $RESTOREDIR/$CONF_DIR/ $CONF_DIR/
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
fi
# Fix permissions
-chown -R root.root $FOLDER
+chown -R root:root $FOLDER
# Trac
if [ -e "$FOLDER/trac" ]; then
# Optionally also: gvcache/ log/
- ( cd $FOLDER/trac && chown -R $TRAC_USER.$TRAC_GROUP attachments conf db auth plugins .egg-cache )
+ ( cd $FOLDER/trac && chown -R $TRAC_USER:$TRAC_GROUP attachments conf db auth plugins .egg-cache )
fi
# PmWiki
if [ -e "$FOLDER/wiki" ]; then
- ( cd $FOLDER/wiki && chown -R $SITE_USER.$SITE_GROUP wiki.d uploads )
- chown $SITE.root $FOLDER/wiki/local/config.php
+ ( cd $FOLDER/wiki && chown -R $SITE_USER:$SITE_GROUP wiki.d uploads )
+ chown $SITE:root $FOLDER/wiki/local/config.php
chmod 660 $FOLDER/wiki/local/config.php
fi
# Site
if [ -e "$FOLDER/site" ]; then
- chown -R $SITE_USER.$SITE_GROUP $FOLDER/site
+ chown -R $SITE_USER:$SITE_GROUP $FOLDER/site
fi
# Drupal
if [ -e "$FOLDER/drupal" ]; then
SERIES="$4"
- chown -R $SITE_USER.$SITE_GROUP $FOLDER/drupal/files
- chown root.$SITE_GROUP $FOLDER/drupal/settings.php
+ chown -R $SITE_USER:$SITE_GROUP $FOLDER/drupal/files
+ chown root:$SITE_GROUP $FOLDER/drupal/settings.php
chmod 640 $FOLDER/drupal/settings.php
if [ -e "/etc/apache2/sites-available/$SITE" ]; then
site="`basename $file .setup`"
git clone file:///var/git/repositories/$SITE /var/sites/$SITE/ikiwiki_src
ikiwiki --setup $file --rebuild
- chown -R $SITE_USER.$SITE_GROUP /var/sites/$SITE/ikiwiki*
+ chown -R $SITE_USER:$SITE_GROUP /var/sites/$SITE/ikiwiki*
else
echo "Either $file or git repository not found for $SITE ikiwiki instance"
fi
# Moin
if [ -e "$FOLDER/moin" ]; then
echo "Restoring moin for $SITE..."
- chown -R root.root $FOLDER/moin/
- chown -R $SITE_USER.$SITE_GROUP $FOLDER/moin/{cgi-bin,data,underlay}
+ chown -R root:root $FOLDER/moin/
+ chown -R $SITE_USER:$SITE_GROUP $FOLDER/moin/{cgi-bin,data,underlay}
fi
rm -rf /var/svn && cp -a $RESTOREDIR/var/svn /var/svn
# Fix permissions.
-chown root.root /var/svn
-chown -R $SERVICE_USER.$SERVICE_GROUP /var/svn/*
+chown root:root /var/svn
+chown -R $SERVICE_USER:$SERVICE_GROUP /var/svn/*
hydra_backup_restore_database sympa
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
#cp -a $RESTOREDIR/$SERVICE_DIR $SERVICE_DIR
#
# Fix permissions.
-#chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+#chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
cp -a $RESTOREDIR/$SERVICE_DIR $SERVICE_DIR
# Fix permissions.
-chown -R $SERVICE_USER.$SERVICE_GROUP $SERVICE_DIR
+chown -R $SERVICE_USER:$SERVICE_GROUP $SERVICE_DIR
if [ ! -e "$DEST_BASE_SITE/.htpasswd" ]; then
touch $DEST_BASE_SITE/.htpasswd
chmod 640 $DEST_BASE_SITE/.htpasswd
- chown root.$BACKUPS_GROUP $DEST_BASE_SITE/.htpasswd
+ chown root:$BACKUPS_GROUP $DEST_BASE_SITE/.htpasswd
fi
# Access setup
tar jcvf $PACK $LOCATION
md5sum $PACK > $PACK.md5
sha1sum $PACK > $PACK.sha1
- chown root.$BACKUPS_GROUP $PACK*
+ chown root:$BACKUPS_GROUP $PACK*
chmod 640 $PACK*
echo "Saved $DEST/$PACK"
fi
rm -f $DATABASE.sql
md5sum $DATABASE.sql.bz2 > $DATABASE.sql.bz2.md5
sha1sum $DATABASE.sql.bz2 > $DATABASE.sql.bz2.sha1
- chown root.$BACKUPS_GROUP $DATABASE.sql*
+ chown root:$BACKUPS_GROUP $DATABASE.sql*
chmod 640 $DATABASE.sql*
echo "Saved $DEST/$DATABASE.sql.bz2"
fi
GROUP="$(stat -c %G $ORIG)"
# With the right permissions
- $SUDO chown $OWNER.$GROUP $DEST
+ $SUDO chown $OWNER:$GROUP $DEST
fi
# First sync the folder structure
function sync_media_playlist_perms {
if [ -d "playlists" ]; then
$sudo chmod 775 playlists
- $sudo chown -R mpd.audio playlists
+ $sudo chown -R mpd:audio playlists
find playlists -type f -exec sudo chmod 664 {} \;
find playlists -type d -exec sudo chmod 775 {} \;
fi
echo "Fixing $INCOMING permissions..."
$sudo find $INCOMING -type f -exec chmod 664 {} \;
$sudo find $INCOMING -type d -exec chmod 775 {} \;
- $sudo chown -R $WHOAMI.incoming $INCOMING
+ $sudo chown -R $WHOAMI:incoming $INCOMING
fi
}
#echo "Fixing $CACHE permissions..."
#$sudo find $CACHE -type f -exec chmod 644 {} \;
#$sudo find $CACHE -type d -exec chmod 755 {} \;
-$sudo chown $WHOAMI. $CACHE
-$sudo chown $WHOAMI. $CACHE/*
+$sudo chown $WHOAMI: $CACHE
+$sudo chown $WHOAMI: $CACHE/*
# Check if a specific repository was passed via the command line
if [ ! -z "$REPOSITORY" ] && [ -d "$CACHE/$REPOSITORY" ] && ! echo "$REPOSITORY" | grep -q -- '--'; then
GROUP="$(stat -c %G /var/cache/`hostname -s`/media)"
# With the right permissions
- $SUDO chown $OWNER.$GROUP $MEDIA
+ $SUDO chown $OWNER:$GROUP $MEDIA
fi
# Guest images were previously synced using rsync