89
88
test -f ~/.chromium-browser.init && . ~/.chromium-browser.init
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
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"
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
111
echo "Already warned about Flash in last $FLASH_STALENESS_REWARN_AT_SOONEST days. Skipping."
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)"
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"
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; }
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"
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; }
144
echo "Already warned about Flash more than $FLASH_STALENESS_MAX_TRIES_PER_100_DAYS times in 100 days."
147
echo "Not checking for flash player staleness."
150
break # Always break out.
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