Created
April 25, 2011 19:38
-
-
Save stouset/941056 to your computer and use it in GitHub Desktop.
Profile update script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# include profile location variables | |
. ~/.profile | |
. ~/.profile.git/profile-env | |
# update ourself | |
(cd $DOT_PROFILE && git pull) | |
# symlink all home.d files into place | |
for FILE in $(find $PROFILE_HOME_D -type f -o -type l); do | |
FILE=${FILE#$PROFILE_HOME_D/} | |
DIR=$(dirname $FILE) | |
echo "# ln -sf $PROFILE_HOME_D/$FILE ~/$FILE" | |
mkdir -p ~/$DIR | |
ln -sf $PROFILE_HOME_D/$FILE ~/$FILE | |
done | |
# remove stale symlinks | |
for DIR in $(find $PROFILE_HOME_D -type d); do | |
DIR=${DIR#$PROFILE_HOME_D} | |
DIR=${DIR#/} | |
for SYMLINK in $(find ~/$DIR -maxdepth 1 -type l); do | |
if [ ! -e $SYMLINK ]; then | |
echo "# rm -i $SYMLINK (stale symlink)" | |
rm -i $SYMLINK | |
fi | |
done | |
done | |
# perform OS-specific tasks | |
for FILE in $(find $PROFILE_SYSTEM_D/$SYSTEM_BASE.d -type f -o -type l); do | |
if [ -x $FILE ]; then | |
echo "# eval $FILE" | |
eval $FILE | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment