#!/bin/bash # Copyright 2016-2020 Jay Flood, SP, Brasil # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Author: brokenman@porteus.org # additions: ncmprhnsbl # version: 20200214 # # This is a starter script to download a live script and update flash. # Source porteus functions . /usr/share/porteus/porteus-functions get_colors #~ # functions set work directory(default is /tmp) to current work directory #~ set_tmp() { #~ WRKDIR=/tmp #~ } #~ set_pwd() { #~ WRKDIR=`pwd` #~ } #~ # echo usage #~ show_help() { #~ echo " options: -d : do operations in the present directory, instead of /tmp . " #~ echo " -h : show this usage. " #~ } #~ while getopts ":-d:-h:" o; do #~ case "$1" in #~ -d) #~ set_pwd;; #~ -h) #~ show_help #~ exit 0;; #~ *) #~ show_help #~ exit 1;; #~ esac #~ done #~ case "$1" in #~ "") #~ set_tmp;; #~ esac #~ ## Set variables #~ FURL="https://get.adobe.com/flashplayer/" #~ WOPT='--no-check-certificate --user-agent="Mozilla Linux" --output-document - --quiet' #~ TMPDIR=$WRKDIR/.flash_updater.$$ #~ ARCH=`uname -m` #~ case "$ARCH" in #~ i?86) ARCH="i386" ; LIBDIRSUFFIX=""; MARCH=i586; ANTIARCH=x86_64; PARCH=32_bit ;; #~ x86_64) ARCH="x86_64" ; LIBDIRSUFFIX="64" ; MARCH=x86_64; ANTIARCH=i386; PARCH=64_bit ;; #~ *) echo "Package for $(uname -m) architecture is not available." ; exit 1 ;; #~ esac #~ ## Variables #~ cleanup(){ #~ rm -rf $TMPDIR 2>/dev/null #~ rm $WRKDIR/flashplayer-plugin*.txt $WRKDIR/flashplayer-plugin*.md5 2>/dev/null #~ rm $WRKDIR/makepkg-flashplayer* 2>/dev/null #~ exit #~ } #~ trap cleanup SIGHUP SIGINT SIGTERM ########### START CHECKS # Check for root if [ `whoami` != "root" ]; then sayerror "Only root can do that" cleanup fi red " \"Since Adobe no longer supports Flash Player after December 31, 2020" red " and blocked Flash content from running in Flash Player beginning January 12, 2021," red " Adobe strongly recommends all users immediately uninstall Flash Player" red " to help protect their systems.\" " cyan " Porteus will no longer supply this module," cyan " and this utility will not be included in future versions of Porteus." # tell us where the work will be done #~ echo "Work will be done in: $WRKDIR " #~ ## Check if there's enough working space #~ [ `df -l --output=avail $WRKDIR | tail -1` -lt 64000 ] && { red "There's not enough space to run this script"; exit 1; } #~ ## Check for flash #~ rf=`find /usr -type f -name "libflashplayer.so"` #~ if [ "$rf" ]; then #~ # FPATH=`realpath $rf` #~ # LFVER=`awk '/LNX / {gsub(/,/,".",$0);print substr($2,1,11)}' $FPATH` #~ LFVER=`find /var/log/packages/flashplayer-plugin* | awk -F- '{print$3}'` #~ else #~ FPATH="Flash is not installed" #~ fi #~ # Make sure we have an internet connection #~ #is_online_url $FURL || { sayerror "An internet connection is required."; exit; } #~ # Make temp directory #~ [ ! -d $TMPDIR ] && mkdir -p $TMPDIR || rm -rf $TMPDIR/* #~ # Get current flashplayer version #~ echo #~ echo "Searching online for latest flash player version ..." #~ RFVER=`wget --no-check-certificate --user-agent="Mozilla Linux" --output-document - --quiet https://get.adobe.com/flashplayer/ | grep -Po '(?<=Version\s)[^\<]*'` #~ if [ -z "$RFVER" ]; then #~ sayerror "Could not connect to the adobe website" #~ exit #~ fi #~ echo #~ echo "Installed version: ${txtbld}${txtgreen}${LFVER}${rst}" #~ echo "Latest version: ${txtbld}${txtgreen}${RFVER}${rst}" #~ echo #~ read -p " Would you like to continue? [y/n]" -n 1 -r -s && echo #~ if [[ ! $REPLY =~ ^[Yy]$ ]]; then cleanup; fi #~ echo " A Slackware package will be created." #~ read -p " Would you like to create a Porteus module? [y/n]" -n 1 -r -s && echo #~ if [[ $REPLY =~ ^[Yy]$ ]]; then #~ MAKEMOD=0 #~ fi #~ # Kill any running versions #~ fpp=`ps ax | grep libflashplayer.so | grep -v grep | awk '{print$1}'` #~ if [ $fpp ]; then #~ echo #~ bold "Please close all browsers to ensure flashplayer is not in use." #~ cleanup #~ fi #~ # Remove any installed flash #~ #if [[ `ls /var/log/packages/flashplayer-plugin* 2>/dev/null` ]]; then #~ # removepkg flashplayer-plugin #~ #fi #~ # Deactivate any running module #~ if [ -e /mnt/live/memory/images/flashplayer-plugin* ]; then #~ deactivate /mnt/live/memory/images/flashplayer-plugin* #~ fi #~ # Download the file #~ #download https://fpdownload.macromedia.com/get/flashplayer/current/licensing/linux/install_flash_player_11_linux.$ARCH.tar.gz $TMPDIR #~ download https://fpdownload.adobe.com/get/flashplayer/pdc/$RFVER/flash_player_npapi_linux.$ARCH.tar.gz $TMPDIR #~ mkdir $TMPDIR/build #~ cd $TMPDIR/build #~ #tar xvf ../install_flash_player_11_linux.$ARCH.tar.gz #~ tar xvf ../flash_player_npapi_linux.$ARCH.tar.gz #~ rm -rf LGPL readme.txt #~ [ ! -d usr/lib/mozilla/plugins ] && mkdir -p usr/lib/mozilla/plugins #~ mv libflashplayer.so usr/lib/mozilla/plugins/ #~ find usr/lib -name "*.so" -exec chmod 755 {} \; #~ # Create 64 bit link #~ if [ "$ARCH" = x86_64 ]; then #~ ln -sf /usr/lib/mozilla usr/lib64/mozilla #~ fi #~ # Create slackware package build files #~ mkdir install #~ cat > install/slack-desc << EOF #~ # HOW TO EDIT THIS FILE: #~ # The "handy ruler" below makes it easier to edit a package description. Line #~ # up the first '|' above the ':' following the base package name, and the '|' #~ # on the right side marks the last column you can put a character in. You must #~ # make exactly 11 lines for the formatting to be correct. It's also #~ # customary to leave one space after the ':'. #~ |-----handy-ruler-----------------------------------------| #~ flashplayer-plugin: flashplayer-plugin (flash plugin for web browsers) #~ flashplayer-plugin: #~ flashplayer-plugin: Provides Adobe Flash plugin for browsers that recognize #~ flashplayer-plugin: /usr/lib/mozilla/plugins as a valid plugin directory #~ flashplayer-plugin: #~ flashplayer-plugin: Plugin is subject to Adobe terms of use: #~ flashplayer-plugin: http://www.adobe.com/go/labs_term_of_use #~ flashplayer-plugin: #~ flashplayer-plugin: Plugin is subject to Adobe Flash EULA: #~ flashplayer-plugin: http://labs.adobe.com/technologies/eula/flashplayer.html #~ flashplayer-plugin: #~ EOF #~ cat > install/doinst.sh << EOM #~ # Update the desktop database: #~ if [ -x usr/bin/update-desktop-database ]; then #~ chroot . /usr/bin/update-desktop-database usr/share/applications > /dev/null 2>&1 #~ fi #~ # Update hicolor theme cache: #~ if [ -d usr/share/icons/hicolor ]; then #~ if [ -x /usr/bin/gtk-update-icon-cache ]; then #~ chroot . /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2> /dev/null #~ fi #~ fi #~ EOM #~ makepkg -l y -c n $WRKDIR/flashplayer-plugin-$RFVER-$MARCH-1.txz #~ [ "$MAKEMOD" ] && txz2xzm $WRKDIR/flashplayer-plugin-$RFVER-$MARCH-1.txz #~ if [ "$MAKEMOD" ]; then #~ echo #~ echo " Your module is ready at" $txtcyan " $WRKDIR/flashplayer-plugin-$RFVER-$MARCH-1.xzm " $rst #~ echo " Please move it to the modules dir to be activated at boot time, " #~ echo " or to some other place outside of the live system to survive reboot. " #~ echo #~ else #~ echo #~ echo " Your package is ready at" $txtcyan " $WRKDIR/flashplayer-plugin-$RFVER-$MARCH-1.txz " $rst #~ echo " Please move it to some other place outside of the live system to survive reboot. " #~ echo " or install to the live system with installpkg or convert to a module with txz2xzm. " #~ echo #~ fi #~ cleanup