Skip to content

Commit

Permalink
install modified to work with bash 3
Browse files Browse the repository at this point in the history
  • Loading branch information
yut45390 committed Oct 5, 2011
1 parent 5286a70 commit 0246b96
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions install.sh
Expand Up @@ -35,38 +35,47 @@ done
### Select a profile ###
########################

typeset -A profiles
for profile_key in $(gconftool-2 -R $gconfdir | grep $gconfdir | cut -d/ -f5 | cut -d: -f1); do
profile_name=$(gconftool-2 -g $gconfdir/$profile_key/visible_name)
profiles[$profile_name]=$profile_key
declare -a profiles
declare -a visnames
profiles=($(gconftool-2 -R $gconfdir | grep $gconfdir | cut -d/ -f5 | cut -d: -f1))

#get visible names
for index in ${!profiles[@]};
do
visnames[$index]=$(gconftool-2 -g $gconfdir/${profiles[$index]}/visible_name);
done

echo "Please select a Gnome Terminal profile:"
select profile_name in "${!profiles[@]}"; do
echo
names=$(eval $(
for index in ${!profiles[@]};
do
if [[ $index == 0 ]];
then
echo "echo";
fi
echo "\${visnames[$index]}";
done ) )
select profile_name in $names;
do
if [[ -z $profile_name ]]; then
echo -e "ERROR: Invalid selection -- ABORTING!\n"
exit 1
fi

profile_key=${profiles[$profile_name]}
break
break;
done

profile_key=${profiles[$profile_name]}
profile_key=$(expr ${REPLY} - 1)

#########################################################
### Show the choices made and prompt for confirmation ###
#########################################################

echo "You have selected:"
echo " Scheme: $scheme"
echo -e " Profile: $profile_name (gconf key: $profile_key)\n"
echo -e " Profile: $profile_name (gconf key: ${profiles[$profile_key]})\n"

typeset -u confirmation
#typeset -u confirmation
echo -n "Is this correct? (YES to continue) "
read confirmation

confirmation=$(echo $confirmation | tr '[:lower:]' '[:upper:]')
if [[ $confirmation != YES ]]; then
echo -e "ERROR: Confirmation failed -- ABORTING!\n"
exit 3
Expand All @@ -78,17 +87,18 @@ fi

echo -e "Confirmation received -- applying settings\n"

profile_path=/apps/gnome-terminal/profiles/${profiles[$profile_key]}
# set palette
gconftool-2 -s -t string /apps/gnome-terminal/profiles/$profile_key/palette $(cat $dir/colors/palette)
gconftool-2 -s -t string $profile_path/palette $(cat $dir/colors/palette)

# set highlighted color to be different from foreground-color
gconftool-2 -s -t bool /apps/gnome-terminal/profiles/$profile_key/bold_color_same_as_fg false
gconftool-2 -s -t bool $profile_path/bold_color_same_as_fg false

# set foreground to base00 and background to base3 and highlight color to base01
gconftool-2 -s -t string /apps/gnome-terminal/profiles/$profile_key/background_color $(cat $bg_color_file)
gconftool-2 -s -t string /apps/gnome-terminal/profiles/$profile_key/foreground_color $(cat $fg_color_file)
gconftool-2 -s -t string /apps/gnome-terminal/profiles/$profile_key/bold_color $(cat $bold_color_file)
gconftool-2 -s -t string $profile_path/background_color $(cat $bg_color_file)
gconftool-2 -s -t string $profile_path/foreground_color $(cat $fg_color_file)
gconftool-2 -s -t string $profile_path/bold_color $(cat $bold_color_file)

# make sure the profile is set to not use theme colors
gconftool-2 -s -t bool /apps/gnome-terminal/profiles/$profile_key/use_theme_colors false
gconftool-2 -s -t bool $profile_path/use_theme_colors false

0 comments on commit 0246b96

Please sign in to comment.