~chromium-team/chromium-browser/artful-beta

« back to all changes in this revision

Viewing changes to debian/chromium-browser.sh.in

  • Committer: Chad MILLER
  • Date: 2015-04-21 15:36:43 UTC
  • Revision ID: chad.miller@canonical.com-20150421153643-0objfwpvuarsjv61
Move flash-staleness program to runner, and keep variables only in the conffile.

Install conffile in the right place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
  . /etc/$APPNAME/default
81
81
fi
82
82
 
83
 
 
84
83
if test -d /etc/$APPNAME/customizations; then
85
84
        while read f; do
86
85
                . "$f"
88
87
fi
89
88
test -f ~/.chromium-browser.init && . ~/.chromium-browser.init
90
89
 
 
90
 
 
91
found_obselete=""
 
92
 
 
93
while true; do  # dumb loop to make control easier inside for errors
 
94
        if test "${FLASH_STALENESS_WARN_DIR}" && test "$FLASH_STALENESS_MAX_TRIES_PER_100_DAYS" && test "${FLASH_STALENESS_REWARN_AT_SOONEST}" && test "${FLASH_STALENESS_GOOD_PACKAGE}" && test "${FLASH_STALENESS_OBSELETE_PACKAGES}"; then 
 
95
                mkdir -p "${FLASH_STALENESS_WARN_DIR}"
 
96
                if find $FLASH_STALENESS_WARN_DIR -mtime -100 -type f |wc -l |xargs test $FLASH_STALENESS_MAX_TRIES_PER_100_DAYS -ge; then
 
97
 
 
98
                        if find "${FLASH_STALENESS_WARN_DIR}" -mtime "-${FLASH_STALENESS_REWARN_AT_SOONEST}" -type f |wc -l |xargs test 1 -gt; then   # not warned in N days
 
99
                                if id -Gn |grep \\bsudo\\b >/dev/null; then   # user could change things
 
100
                                        for pkg in ${FLASH_STALENESS_OBSELETE_PACKAGES}; do
 
101
                                                if test -f /var/lib/dpkg/info/${pkg}.list; then   # likely installed
 
102
                                                        dpkg -l flashplugin-installer >/dev/null && found_obselete="$pkg $found_obselete"
 
103
                                                fi
 
104
                                        done
 
105
                                else
 
106
                                        echo "Even if we warned about this bad flash, user can not update it."
 
107
                                        zenity --info --text "Your computer has an outdated version of Flash plugin. You should install '$FLASH_STALENESS_GOOD_PACKAGE' package." &
 
108
                                        echo >"${FLASH_STALENESS_WARN_DIR}/sudo-not-available"  # rate limited, but never grows count more than 1
 
109
                                fi
 
110
                        else
 
111
                                echo "Already warned about Flash in last $FLASH_STALENESS_REWARN_AT_SOONEST days. Skipping."
 
112
                        fi
 
113
 
 
114
                        if test "${found_obselete}"; then
 
115
                                # do we have a better suggestion?
 
116
                                have_better_package=""
 
117
                                apt-cache search "${FLASH_STALENESS_GOOD_PACKAGE}" >/dev/null && have_better_package=$FLASH_STALENESS_GOOD_PACKAGE
 
118
                                warn_file="${FLASH_STALENESS_WARN_DIR}/$(date +%Y%m%d)"
 
119
                                echo >"$warn_file"
 
120
 
 
121
                                if test "$have_better_package"; then
 
122
                                        zenity --question --text="The Flash player plugin you have installed is out of date. Do you wish to update it now?" --title="Update flash?" --ok-label "Update" --cancel-label "Skip"
 
123
                                        case $? in
 
124
                                                0)
 
125
                                                        gksu --message "Step 1/2. Retrieve new package list. Requires owner verification" -- xterm -e apt-get update || { rm "$warn_file"; zenity --info --text 'Will try again later.'; break; }
 
126
                                                        gksu --message "Step 2/2. Install new package. Requires owner verification" -- xterm -e apt-get -y install ${FLASH_STALENESS_GOOD_PACKAGE} || { rm "$warn_file"; zenity --info --text 'Will try again later.'; break; }
 
127
                                                        ;;
 
128
                                        esac
 
129
                                else
 
130
                                        zenity --question --text="The Flash player plugin you have installed is out of date. Do you wish to enable the Canonical Partner software source and update it now?" --title="Update flash?" --ok-label "Enable and update" --cancel-label "Skip"
 
131
                                        case $? in
 
132
                                                0)
 
133
                                                        partner_file=$(mktemp canonical-partner-new-source-XXXXXX)
 
134
                                                        distro=$(lsb_release -c -s)
 
135
                                                        echo "deb http://archive.canonical.com/ubuntu ${distro:-vivid} partner" >${partner_file}
 
136
                                                        gksu --message "Step 1/3. Create a new partner source. Requires owner verification" -- mv "${partner_file}" /etc/apt/sources.d/canonical-partners.list || { rm "$warn_file"; zenity --info --text 'Will try again later.'; break; }
 
137
                                                        gksu --message "Step 2/3. Retrieve new package list. Requires owner verification" -- xterm -e apt-get update || { rm "$warn_file"; zenity --info --text 'Will try again later.'; break; }
 
138
                                                        gksu --message "Step 3/3. Install new package. Requires owner verification" -- xterm -e apt-get -y install ${FLASH_STALENESS_GOOD_PACKAGE} || { rm "$warn_file"; zenity --info --text 'Will try again later.'; break; }
 
139
                                                        ;;
 
140
                                        esac
 
141
                                fi
 
142
                        fi
 
143
                else
 
144
                        echo "Already warned about Flash more than $FLASH_STALENESS_MAX_TRIES_PER_100_DAYS times in 100 days."
 
145
                fi
 
146
        else
 
147
                echo "Not checking for flash player staleness."
 
148
        fi
 
149
        
 
150
        break  # Always break out.
 
151
done
 
152
 
91
153
# Prefer user defined CHROMIUM_USER_FLAGS (fron env) over system
92
154
# default CHROMIUM_FLAGS (from /etc/$APPNAME/default)
93
155
if test -n "$CHROMIUM_USER_FLAGS"; then