pre_upgrade() { echo "Checking 33 firejail profiles for user modification, backing up as needed..." FilesToCheck=( '/etc/firejail/audacious.profile' '/etc/firejail/clementine.profile' '/etc/firejail/conkeror.profile' '/etc/firejail/deadbeef.profile' '/etc/firejail/deluge.profile' '/etc/firejail/disable-common.inc' '/etc/firejail/disable-devel.inc' '/etc/firejail/disable-mgmt.inc' '/etc/firejail/disable-secret.inc' '/etc/firejail/empathy.profile' '/etc/firejail/evince.profile' '/etc/firejail/fbreader.profile' '/etc/firejail/filezilla.profile' '/etc/firejail/firefox.profile' '/etc/firejail/generic.profile' '/etc/firejail/gnome-mplayer.profile' '/etc/firejail/icecat.profile' '/etc/firejail/icedove.profile' '/etc/firejail/iceweasel.profile' '/etc/firejail/login.users' '/etc/firejail/midori.profile' '/etc/firejail/pidgin.profile' '/etc/firejail/qbittorrent.profile' '/etc/firejail/quassel.profile' '/etc/firejail/rhythmbox.profile' '/etc/firejail/server.profile' '/etc/firejail/thunderbird.profile' '/etc/firejail/totem.profile' '/etc/firejail/transmission-gtk.profile' '/etc/firejail/transmission-qt.profile' '/etc/firejail/vlc.profile' '/etc/firejail/wine.profile' '/etc/firejail/xchat.profile') OriginalFileHashes=( '475365b623b1f879005476ca6ea5d6e6c17f1cfaeb81bade5d99256e86eb52592abb07fefd7b25dd02ac11fcc83f9b31ba7e5bb0124225b19f44d559d5aceb9e' '7c57c690f0e38b2095cff19d7460c4f833efa979a303d579d16ee306184ff3c9ea94b4e2ec926958354c42cb5c47ee53674d81ae6f8adcd1279c9e905c622d1f' '6bf30e18a4e6cf02fcb3021378a7e8fe7edc1afe4b2012fbc567003d2f2446f7c0a4fc15b4c2a04c038d65393a9add1fc1fbcdecd7011c8fc496e6af5eee155e' 'd1e95c53bc19da0e644b4ebe5bd20fa5e9cc7862f2e07110d7ce4f9a45ddb679b38edfb9ff26c1ad6b0e49d359d15334995475004b2c5a1e1aeac40278bb4b2d' '953009d2f096c909fbb597d61981ab620d8214e538da57f172773fedaf1b1dba959fcd21104da1a4bfb2723d366a8e35699ba7166614888d8c33c757c23dc460' '74a3cdca9da6ee82467b7c7e077d7aabd3440b4bef54cac8c9548724468e22b7cec11c4a50360d7e6db18a53f99be5bb39ca023722a4e266039ae491b68a9793' '08a24b721f29a21aff677152079607b95cb523cb379a04c909c80bacd5cad12ebc1f7f8ce40bf84598d6d7df5cbe1638789534259dcac27ca956546365a2e18b' 'c36cb56d0ca440307fea86ed41d697603f48a0273dd313aad3ddc5886a31f43425c24546cda6227b55d11ab2f46352b3f2591239d08694f2442e4b30525ac3b9' '8a07bb966834e91d8dacfb29399655a3e5e48b752fe04b30ba79125b60f82b40a25cf8047b2e7a2882d1c67494f5b42a0243377ae55ee7dbb66fb2dfe8b4d1e8' '1aed5fd7a711f68e1d1522be8caee86c8f0df2799b3d5e59abea96fa4c3424d5df393b549c15eff3ffe849a9ba3a2a96f1eb41ea9a4ef003a2344df15e107f8f' '93f40b47b08eee43e02db3915ac8e1275114f754dc6b24707ad07d2007c4c9abd8a09984e4ce78fda25100908f863a4cba5d6256d227816af717510145366ed5' 'c4810f982f370f480f116eefe33bccd5f91a60f615a809b8c5e66db6c6e557f42cea07e66ddd41badad39a4e0a39cafc4fee82ad8aa61fe4fb6c6b2a3d812491' 'd635adcc12bdc92e9fae2ab7084c4506aa4f4687881478820f2c979de7d822d7ccb45bb6eee19923e498c163ceb7bf62e73d5ab362aa9c96b5d1df94e57c2124' 'fb475c80095f4e5c2fda5d540af4c0499fb07fa080f0c76634458d611de202249789f7d5586ab8b7dede9c0fd8c8fe0c9dc26c3b7f537d696ff0c2f13230b188' 'fb6c319412a8f5c45361354508d08a020df1798cb00fa3295be0df9eebd0dd7efe59189106402a6b8761afd11dff8bc438f7ac1c7de981a5bcebd0027e428ccc' '3b3e54a9fc1e60da4082660b2f179a7667f79da1094325eb6979bf08a3f5a7dc2e54c28041363e7555f5b2eb4590810c20ec9e5914a6c1c4323a86727a01f8c9' '81db63b03b1f950b1e7810fab38ce4fe5776f11e3036848da6298d9002b5c4683028d4fdd630db118d428fd91e5118872b5b2ccff9c82d02a966765efdb9dc17' '9a8c4d7ce893340da2d9cc8237cecf8bca2865e5552747c480a1f803072960b7aa571b2693600076ea8800b86e1d0945d8a535fffcdbe9569b3820a477b155d2' '8ded98eec8c11af8defef583227ea833beca534e5f2be48b52ec75152afddf14d78ba47442237e84eda8bb1b8361b1afecd63576f8ef6b18d50fb8c6559e8638' '672fa8b25ed28a07efb41fad6415c9fa96ce4bf4f4a1a6412595afb309ef6c1e67033ee256f997c32e9abe25bd6a100160ff12f2235c9be289c223547d03ca95' '92d90375a560f3d6c94b3cf6c2d0de06d8e76d8d40eb80ebaf85de844b323c0ec283bc9bca753b2bf301587dda5237883ccd6062f9d5e3c2e8dc7dc33476ce6a' '6a2869827fb38740ef81b93c88880f55a3fb186a82ff6e0dc4142d1fd620d3eb53f8fb36e95482afea6b7865a9cf9d2a7dea172a90792ca37a24f0af6ed39b69' 'e18d294d10a103f1da5d27a12ee867c84920dcd081f7c4daa4e46f6722962a993c3c62295daaed4c19b928d336dda56d4f2ae75dd1c3d5c5f35f878ce76060f0' '2278e3d1ec06e20c2aa7bcced46a5c01bf55f94d6e286f6433bf44177c912709e8d5e0a4c553b2a3af67dfdca6061e95eadfb648f4c606f0bd819b5fef1af03f' 'b8d8a9620a28b67752788c2af2fc0a63f479ea7424dadd9047a000f7782ae4e268ab42861c4f26707236df0c061f1e768f7d6fb580e027af10b9679a1bfb8eec' '0fa8393eaa3c0e5514e44e42ed9f8085c2aa8ddfa799e4cdd19d1004c81692dc1baa8963aa75dfbb7e268c80636711a90110f365e2f3d0769d7fdf0b6aaac65e' '9a3a9f1c59810b82c3a331d3e360f77934712126b70184df5ba2aec52adb28f1ca7d6e5c61ffc6950435468cfb5d529b896462897497341c435068febad472b7' '983f048d3627fbd22be0694f5a4dde1ff874e60206563addb0e2c52506229c36438e48ff8475fb27a388b33f3f93fc52a440e1b604e00610c799c8499cb55593' '06c5591cd4e167f71e72f061ed1efaea0ab138acb562c6f5a7fb9340239e2465d22fd5ac992684444707f14c051d026cabd81f4408117d2d2f22bc089dcbfcb4' '400bfb6f3ee38c73d584cb2e66e37464b6ce75f50a1edaec688405e46e943a62161ae63ba9e0a534887b4ce9ce25c95ca222d2f24111d9f40f455f3412694280' 'c84cc10ee40620846fc0e852e78277afcd96251857f955973036b416f57e6c2c72a8631e1377d4bcea6409129ba909895f1437a81b71a93523463686fc0daba8' '597e7e5779766a4baf606c78218b9c0f9cd87a80ff9e00d5cb7506bc75a2ad79b0c6a65c12362c14afe113a7e6cda7f9808c809eaa601badc61a7aceb54ce16f' '70eaadc12a480cce08ba46a393b3c158821eacc445806714e128f99f50a92aaae769e7cee73f4bf3451846fce0395936c71bcd110929a1ada8bd06f579e67ff6') ## Uses above arrays to check if file's original hash matches, if not the file was edited, so we save a backup and notify the user. [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[0]} | awk '{print $1}')" = ${OriginalFileHashes[0]} ]] || { cat "${FilesToCheck[0]}" > "${FilesToCheck[0]}.pacsave" ; echo "Backup saved: ${FilesToCheck[0]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[1]} | awk '{print $1}')" = ${OriginalFileHashes[1]} ]] || { cat "${FilesToCheck[1]}" > "${FilesToCheck[1]}.pacsave" ; echo "Backup saved: ${FilesToCheck[1]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[2]} | awk '{print $1}')" = ${OriginalFileHashes[2]} ]] || { cat "${FilesToCheck[2]}" > "${FilesToCheck[2]}.pacsave" ; echo "Backup saved: ${FilesToCheck[2]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[3]} | awk '{print $1}')" = ${OriginalFileHashes[3]} ]] || { cat "${FilesToCheck[3]}" > "${FilesToCheck[3]}.pacsave" ; echo "Backup saved: ${FilesToCheck[3]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[4]} | awk '{print $1}')" = ${OriginalFileHashes[4]} ]] || { cat "${FilesToCheck[4]}" > "${FilesToCheck[4]}.pacsave" ; echo "Backup saved: ${FilesToCheck[4]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[5]} | awk '{print $1}')" = ${OriginalFileHashes[5]} ]] || { cat "${FilesToCheck[5]}" > "${FilesToCheck[5]}.pacsave" ; echo "Backup saved: ${FilesToCheck[5]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[6]} | awk '{print $1}')" = ${OriginalFileHashes[6]} ]] || { cat "${FilesToCheck[6]}" > "${FilesToCheck[6]}.pacsave" ; echo "Backup saved: ${FilesToCheck[6]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[7]} | awk '{print $1}')" = ${OriginalFileHashes[7]} ]] || { cat "${FilesToCheck[7]}" > "${FilesToCheck[7]}.pacsave" ; echo "Backup saved: ${FilesToCheck[7]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[8]} | awk '{print $1}')" = ${OriginalFileHashes[8]} ]] || { cat "${FilesToCheck[8]}" > "${FilesToCheck[8]}.pacsave" ; echo "Backup saved: ${FilesToCheck[8]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[9]} | awk '{print $1}')" = ${OriginalFileHashes[9]} ]] || { cat "${FilesToCheck[9]}" > "${FilesToCheck[9]}.pacsave" ; echo "Backup saved: ${FilesToCheck[9]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[10]} | awk '{print $1}')" = ${OriginalFileHashes[10]} ]] || { cat "${FilesToCheck[10]}" > "${FilesToCheck[10]}.pacsave" ; echo "Backup saved: ${FilesToCheck[10]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[11]} | awk '{print $1}')" = ${OriginalFileHashes[11]} ]] || { cat "${FilesToCheck[11]}" > "${FilesToCheck[11]}.pacsave" ; echo "Backup saved: ${FilesToCheck[11]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[12]} | awk '{print $1}')" = ${OriginalFileHashes[12]} ]] || { cat "${FilesToCheck[12]}" > "${FilesToCheck[12]}.pacsave" ; echo "Backup saved: ${FilesToCheck[12]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[13]} | awk '{print $1}')" = ${OriginalFileHashes[13]} ]] || { cat "${FilesToCheck[13]}" > "${FilesToCheck[13]}.pacsave" ; echo "Backup saved: ${FilesToCheck[13]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[14]} | awk '{print $1}')" = ${OriginalFileHashes[14]} ]] || { cat "${FilesToCheck[14]}" > "${FilesToCheck[14]}.pacsave" ; echo "Backup saved: ${FilesToCheck[14]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[15]} | awk '{print $1}')" = ${OriginalFileHashes[15]} ]] || { cat "${FilesToCheck[15]}" > "${FilesToCheck[15]}.pacsave" ; echo "Backup saved: ${FilesToCheck[15]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[16]} | awk '{print $1}')" = ${OriginalFileHashes[16]} ]] || { cat "${FilesToCheck[16]}" > "${FilesToCheck[16]}.pacsave" ; echo "Backup saved: ${FilesToCheck[16]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[17]} | awk '{print $1}')" = ${OriginalFileHashes[17]} ]] || { cat "${FilesToCheck[17]}" > "${FilesToCheck[17]}.pacsave" ; echo "Backup saved: ${FilesToCheck[17]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[18]} | awk '{print $1}')" = ${OriginalFileHashes[18]} ]] || { cat "${FilesToCheck[18]}" > "${FilesToCheck[18]}.pacsave" ; echo "Backup saved: ${FilesToCheck[18]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[19]} | awk '{print $1}')" = ${OriginalFileHashes[19]} ]] || { cat "${FilesToCheck[19]}" > "${FilesToCheck[19]}.pacsave" ; echo "Backup saved: ${FilesToCheck[19]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[20]} | awk '{print $1}')" = ${OriginalFileHashes[20]} ]] || { cat "${FilesToCheck[20]}" > "${FilesToCheck[20]}.pacsave" ; echo "Backup saved: ${FilesToCheck[20]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[21]} | awk '{print $1}')" = ${OriginalFileHashes[21]} ]] || { cat "${FilesToCheck[21]}" > "${FilesToCheck[21]}.pacsave" ; echo "Backup saved: ${FilesToCheck[21]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[22]} | awk '{print $1}')" = ${OriginalFileHashes[22]} ]] || { cat "${FilesToCheck[22]}" > "${FilesToCheck[22]}.pacsave" ; echo "Backup saved: ${FilesToCheck[22]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[23]} | awk '{print $1}')" = ${OriginalFileHashes[23]} ]] || { cat "${FilesToCheck[23]}" > "${FilesToCheck[23]}.pacsave" ; echo "Backup saved: ${FilesToCheck[23]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[24]} | awk '{print $1}')" = ${OriginalFileHashes[24]} ]] || { cat "${FilesToCheck[24]}" > "${FilesToCheck[24]}.pacsave" ; echo "Backup saved: ${FilesToCheck[24]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[25]} | awk '{print $1}')" = ${OriginalFileHashes[25]} ]] || { cat "${FilesToCheck[25]}" > "${FilesToCheck[25]}.pacsave" ; echo "Backup saved: ${FilesToCheck[25]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[26]} | awk '{print $1}')" = ${OriginalFileHashes[26]} ]] || { cat "${FilesToCheck[26]}" > "${FilesToCheck[26]}.pacsave" ; echo "Backup saved: ${FilesToCheck[26]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[27]} | awk '{print $1}')" = ${OriginalFileHashes[27]} ]] || { cat "${FilesToCheck[27]}" > "${FilesToCheck[27]}.pacsave" ; echo "Backup saved: ${FilesToCheck[27]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[28]} | awk '{print $1}')" = ${OriginalFileHashes[28]} ]] || { cat "${FilesToCheck[28]}" > "${FilesToCheck[28]}.pacsave" ; echo "Backup saved: ${FilesToCheck[28]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[29]} | awk '{print $1}')" = ${OriginalFileHashes[29]} ]] || { cat "${FilesToCheck[29]}" > "${FilesToCheck[29]}.pacsave" ; echo "Backup saved: ${FilesToCheck[29]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[30]} | awk '{print $1}')" = ${OriginalFileHashes[30]} ]] || { cat "${FilesToCheck[30]}" > "${FilesToCheck[30]}.pacsave" ; echo "Backup saved: ${FilesToCheck[30]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[31]} | awk '{print $1}')" = ${OriginalFileHashes[31]} ]] || { cat "${FilesToCheck[31]}" > "${FilesToCheck[31]}.pacsave" ; echo "Backup saved: ${FilesToCheck[31]}.pacsave"; } [[ "$(openssl dgst -r -whirlpool ${FilesToCheck[32]} | awk '{print $1}')" = ${OriginalFileHashes[32]} ]] || { cat "${FilesToCheck[32]}" > "${FilesToCheck[32]}.pacsave" ; echo "Backup saved: ${FilesToCheck[32]}.pacsave"; } echo "Done!" }