From 501683a3d5ce94037d0055d1dbf44204869c5d23 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Thu, 30 Jun 2016 22:59:35 +0100 Subject: [PATCH 01/40] rebase to xenial --- Dockerfile | 64 +- LICENSE | 675 ------------------ README.md | 19 +- .../defaults/plexmediaserver | 0 root/etc/cont-init.d/10_add_user | 31 + .../etc/cont-init.d/20-dbus | 3 +- .../etc/cont-init.d/30-plex-update | 6 +- .../etc/cont-init.d/40-chown-files | 3 +- root/etc/services.d/avahi/run | 9 + {services => root/etc/services.d}/dbus/run | 4 +- root/etc/services.d/plex/run | 5 + services/avahi/run | 3 - services/plex/run | 4 - 13 files changed, 111 insertions(+), 715 deletions(-) delete mode 100644 LICENSE rename plexmediaserver => root/defaults/plexmediaserver (100%) create mode 100644 root/etc/cont-init.d/10_add_user rename init/10_dbus.sh => root/etc/cont-init.d/20-dbus (83%) rename init/30_update_plex.sh => root/etc/cont-init.d/30-plex-update (94%) rename init/90_chown_plex_owned_files.sh => root/etc/cont-init.d/40-chown-files (90%) create mode 100644 root/etc/services.d/avahi/run rename {services => root/etc/services.d}/dbus/run (67%) create mode 100644 root/etc/services.d/plex/run delete mode 100644 services/avahi/run delete mode 100644 services/plex/run diff --git a/Dockerfile b/Dockerfile index ff747c3..6e10e3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,53 @@ -FROM linuxserver/baseimage -MAINTAINER Stian Larsen +FROM ubuntu:16.04 +MAINTAINER Stian Larsen, sparklyballs -# Install Plex -RUN apt-get -q update && \ -apt-get install -qy dbus avahi-daemon wget && \ -curl -L 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' -o /tmp/plexmediaserver.deb && \ -dpkg -i /tmp/plexmediaserver.deb && rm -f /tmp/plexmediaserver.deb && \ -apt-get clean && \ -rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# global environment settings +ENV DEBIAN_FRONTEND="noninteractive" +ENV HOME="/config" +ENV TERM="xterm" +# add abc user and make folders +RUN \ + useradd -u 911 -U -d /config -s /bin/false abc && \ + usermod -G users abc && \ + mkdir -p \ + /config -#Adding Custom files -COPY init/ /etc/my_init.d/ -COPY services/ /etc/service/ -RUN chmod -v +x /etc/service/*/run /etc/my_init.d/*.sh +# install packages +RUN \ + apt-get update && \ + apt-get install -y \ + apt-utils && \ + apt-get install -y \ + avahi-daemon \ + curl \ + dbus \ + wget && \ -# Define /config in the configuration file not using environment variables -COPY plexmediaserver /defaults/plexmediaserver +# add s6 overlay + curl -o \ + /tmp/s6.tar.gz -L \ + https://github.com/just-containers/s6-overlay/releases/download/v1.17.2.0/s6-overlay-amd64.tar.gz && \ + tar xvf /tmp/s6.tar.gz -C / && \ -#Mappings and ports -VOLUME ["/config"] +# cleanup + apt-get clean && \ + rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* + +# install plex +RUN \ + curl -o \ + /tmp/plexmediaserver.deb -L \ + 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' && \ + dpkg -i /tmp/plexmediaserver.deb && \ + rm -f /tmp/plexmediaserver.deb + + +ENTRYPOINT ["/init"] + +# add local files +COPY root/ / + +# ports and volumes +VOLUME /config EXPOSE 32400 32400/udp 32469 32469/udp 5353/udp 1900/udp diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 733c072..0000000 --- a/LICENSE +++ /dev/null @@ -1,675 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - diff --git a/README.md b/README.md index b51ada7..225f056 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,13 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel ## Changelog -+ **07.04.2016:** removed `/transcode` volume support (upstream Plex change) and modified PlexPass download method to prevent unauthorised usage of paid PMS -+ **24.09.2015:** added optional support for volume transcoding (/transcode), and various typo fixes. -+ **17.09.2015:** Changed to run chmod only once -+ **19.09.2015:** Plex updated their download servers from http to https -+ **28.08.2015:** Removed plexpass from routine, and now uses VERSION as a combination fix. -+ **18.07.2015:** Moved autoupdate to be hosted by linuxserver.io and implemented bugfix thanks to ljm42. -+ **09.07.2015:** Now with ability to pick static version number. -+ **08.07.2015:** Now with autoupdates. (Hosted by fanart.tv) -+ **03.07.2015:** Fixed a mistake that allowed plex to run as user plex rather than abc (99:100). Thanks to double16 for spotting this. ++ **30.06.16:** Rebased to xenial and s6 overlay ++ **07.04.16:** removed `/transcode` volume support (upstream Plex change) and modified PlexPass download method to prevent unauthorised usage of paid PMS ++ **24.09.15:** added optional support for volume transcoding (/transcode), and various typo fixes. ++ **17.09.15:** Changed to run chmod only once ++ **19.09.15:** Plex updated their download servers from http to https ++ **28.08.15:** Removed plexpass from routine, and now uses VERSION as a combination fix. ++ **18.07.15:** Moved autoupdate to be hosted by linuxserver.io and implemented bugfix thanks to ljm42. ++ **09.07.15:** Now with ability to pick static version number. ++ **08.07.15:** Now with autoupdates. (Hosted by fanart.tv) ++ **03.07.15:** Fixed a mistake that allowed plex to run as user plex rather than abc (99:100). Thanks to double16 for spotting this. diff --git a/plexmediaserver b/root/defaults/plexmediaserver similarity index 100% rename from plexmediaserver rename to root/defaults/plexmediaserver diff --git a/root/etc/cont-init.d/10_add_user b/root/etc/cont-init.d/10_add_user new file mode 100644 index 0000000..b76f8ff --- /dev/null +++ b/root/etc/cont-init.d/10_add_user @@ -0,0 +1,31 @@ +#!/usr/bin/with-contenv bash + + + +PUID=${PUID:-911} +PGID=${PGID:-911} + +if [ ! "$(id -u abc)" -eq "$PUID" ]; then usermod -o -u "$PUID" abc ; fi +if [ ! "$(id -g abc)" -eq "$PGID" ]; then groupmod -o -g "$PGID" abc ; fi + +echo " +------------------------------------- + _ _ _ + | |___| (_) ___ + | / __| | |/ _ \ + | \__ \ | | (_) | + |_|___/ |_|\___/ + |_| + +Brought to you by linuxserver.io +We do accept donations at: +https://www.linuxserver.io/donations +------------------------------------- +GID/UID +------------------------------------- +User uid: $(id -u abc) +User gid: $(id -g abc) +------------------------------------- +" +chown abc:abc /config +chown abc:abc /defaults diff --git a/init/10_dbus.sh b/root/etc/cont-init.d/20-dbus similarity index 83% rename from init/10_dbus.sh rename to root/etc/cont-init.d/20-dbus index 68ad650..fcda4ba 100644 --- a/init/10_dbus.sh +++ b/root/etc/cont-init.d/20-dbus @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/with-contenv bash [[ -e /var/run/dbus/pid ]] && rm -f /var/run/dbus/pid @@ -6,3 +6,4 @@ mkdir -p /var/run/dbus chown messagebus:messagebus /var/run/dbus dbus-uuidgen --ensure sleep 1 + diff --git a/init/30_update_plex.sh b/root/etc/cont-init.d/30-plex-update similarity index 94% rename from init/30_update_plex.sh rename to root/etc/cont-init.d/30-plex-update index ef95e5b..aaea785 100644 --- a/init/30_update_plex.sh +++ b/root/etc/cont-init.d/30-plex-update @@ -1,11 +1,8 @@ -#!/bin/bash +#!/usr/bin/with-contenv bash # opt out for autoupdates [ "$ADVANCED_DISABLEUPDATES" ] && exit 0 -export DEBIAN_FRONTEND=noninteractive - -while ! ping -c1 tools.linuxserver.io &>/dev/null; do :; done #The following error is not an error. INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) @@ -53,3 +50,4 @@ else echo "No need to update!" fi cp -v /defaults/plexmediaserver /etc/default/plexmediaserver + diff --git a/init/90_chown_plex_owned_files.sh b/root/etc/cont-init.d/40-chown-files similarity index 90% rename from init/90_chown_plex_owned_files.sh rename to root/etc/cont-init.d/40-chown-files index 643c2c8..26405d3 100644 --- a/init/90_chown_plex_owned_files.sh +++ b/root/etc/cont-init.d/40-chown-files @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/with-contenv bash if [ ! -d "/config/Library" ]; then mkdir /config/Library @@ -9,3 +9,4 @@ if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then find /config/Library ! \( -user abc -a -group root \) -print0 | xargs -0 chown abc:root touch /config/Library/linuxserver-chown.lock fi + diff --git a/root/etc/services.d/avahi/run b/root/etc/services.d/avahi/run new file mode 100644 index 0000000..41851f1 --- /dev/null +++ b/root/etc/services.d/avahi/run @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash + +until [[ -e /var/run/dbus/system_bus_socket ]]; do +sleep 1s +done + +echo "Starting Avahi daemon" +exec avahi-daemon --no-chroot + diff --git a/services/dbus/run b/root/etc/services.d/dbus/run similarity index 67% rename from services/dbus/run rename to root/etc/services.d/dbus/run index 2117201..e2a078f 100644 --- a/services/dbus/run +++ b/root/etc/services.d/dbus/run @@ -1,3 +1,5 @@ -#!/bin/bash +#!/usr/bin/with-contenv bash + echo "Starting dbus-daemon" exec dbus-daemon --system --nofork + diff --git a/root/etc/services.d/plex/run b/root/etc/services.d/plex/run new file mode 100644 index 0000000..0a979f9 --- /dev/null +++ b/root/etc/services.d/plex/run @@ -0,0 +1,5 @@ +#!/usr/bin/with-contenv bash + +echo "Starting Plex Media Server." +exec s6-setuidgid abc /usr/sbin/start_pms + diff --git a/services/avahi/run b/services/avahi/run deleted file mode 100644 index 7327400..0000000 --- a/services/avahi/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo "Starting Avahi daemon" -exec avahi-daemon --no-chroot diff --git a/services/plex/run b/services/plex/run deleted file mode 100644 index fcff91c..0000000 --- a/services/plex/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -echo "Starting Plex Media Server." -exec /sbin/setuser abc /usr/sbin/start_pms From 0a89101b9400e57a07c325f7fc3284629d7efbee Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Fri, 1 Jul 2016 04:04:51 +0100 Subject: [PATCH 02/40] rebase to use lsiobase/xenial --- Dockerfile | 22 +--------------------- root/etc/cont-init.d/10_add_user | 31 ------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 root/etc/cont-init.d/10_add_user diff --git a/Dockerfile b/Dockerfile index 6e10e3e..cf066ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM lsiobase/xenial MAINTAINER Stian Larsen, sparklyballs # global environment settings @@ -6,30 +6,13 @@ ENV DEBIAN_FRONTEND="noninteractive" ENV HOME="/config" ENV TERM="xterm" -# add abc user and make folders -RUN \ - useradd -u 911 -U -d /config -s /bin/false abc && \ - usermod -G users abc && \ - mkdir -p \ - /config - # install packages RUN \ apt-get update && \ - apt-get install -y \ - apt-utils && \ apt-get install -y \ avahi-daemon \ - curl \ dbus \ wget && \ - -# add s6 overlay - curl -o \ - /tmp/s6.tar.gz -L \ - https://github.com/just-containers/s6-overlay/releases/download/v1.17.2.0/s6-overlay-amd64.tar.gz && \ - tar xvf /tmp/s6.tar.gz -C / && \ - # cleanup apt-get clean && \ rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* @@ -42,9 +25,6 @@ RUN \ dpkg -i /tmp/plexmediaserver.deb && \ rm -f /tmp/plexmediaserver.deb - -ENTRYPOINT ["/init"] - # add local files COPY root/ / diff --git a/root/etc/cont-init.d/10_add_user b/root/etc/cont-init.d/10_add_user deleted file mode 100644 index b76f8ff..0000000 --- a/root/etc/cont-init.d/10_add_user +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/with-contenv bash - - - -PUID=${PUID:-911} -PGID=${PGID:-911} - -if [ ! "$(id -u abc)" -eq "$PUID" ]; then usermod -o -u "$PUID" abc ; fi -if [ ! "$(id -g abc)" -eq "$PGID" ]; then groupmod -o -g "$PGID" abc ; fi - -echo " -------------------------------------- - _ _ _ - | |___| (_) ___ - | / __| | |/ _ \ - | \__ \ | | (_) | - |_|___/ |_|\___/ - |_| - -Brought to you by linuxserver.io -We do accept donations at: -https://www.linuxserver.io/donations -------------------------------------- -GID/UID -------------------------------------- -User uid: $(id -u abc) -User gid: $(id -g abc) -------------------------------------- -" -chown abc:abc /config -chown abc:abc /defaults From 37eab12ea31009a1060654c93eda292bc15f67ba Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Fri, 1 Jul 2016 04:06:42 +0100 Subject: [PATCH 03/40] edit environment settings --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cf066ac..8a0a385 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ MAINTAINER Stian Larsen, sparklyballs # global environment settings ENV DEBIAN_FRONTEND="noninteractive" ENV HOME="/config" -ENV TERM="xterm" # install packages RUN \ From 5888cf11be6e5787d723cde9d2d0efacd296af21 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 2 Jul 2016 20:15:50 +0100 Subject: [PATCH 04/40] working on plex update script --- Dockerfile | 1 + root/etc/cont-init.d/30-plex-update | 53 +++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a0a385..1a2363f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN \ apt-get install -y \ avahi-daemon \ dbus \ + less \ wget && \ # cleanup apt-get clean && \ diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index aaea785..bf917e2 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -3,22 +3,55 @@ # opt out for autoupdates [ "$ADVANCED_DISABLEUPDATES" ] && exit 0 +# set header for no preferences/token message +[[ -e /tmp/no-token.nfo ]] && rm /tmp/no-token.nfo +NOTOKEN_SET='/tmp/no-token.nfo' +cat > "${NOTOKEN_SET}" <<-EOFTOKEN -#The following error is not an error. -INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) +##################################################### +# Login via webui and restart, because there was no # +EOFTOKEN -#Get stuff from things. -PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed "s/\".*//") -[ -z "$PLEX_TOKEN" ] && echo "Plex token not avalible, please login " && exit 0 +# if preferences files doesn't exist, exit out +if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then +cat >> "${NOTOKEN_SET}" <<-EOFTOKEN +# preference file found, possibly first startup. # +##################################################### -[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" -if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi +EOFTOKEN +less /tmp/no-token.nfo +exit 0 +fi + +# attempt to read plex token +PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ +"/config/Library/Application Support/Plex Media Server/Preferences.xml" \ +| sed "s/\".*//") -#Start update rutine +# if plex token isn't found, exit out +if [ -z "$PLEX_TOKEN" ]; then +cat >> "${NOTOKEN_SET}" <<-EOFTOKEN +# plex token in the preferences file in config # +##################################################### + + +EOFTOKEN +less /tmp/no-token.nfo +exit 0 +fi + +# determine installed version of plex +INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) +# start update routine + +[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" + +if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi + if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) echo "Target version: $VERSION set by: latest\plexpass" @@ -31,9 +64,6 @@ else echo "Target version: $VERSION set by: manually" fi - - - last=130 if [[ "$VERSION" == "" ]]; then echo "ERROR: No version found, running installed version $INSTALLED" @@ -49,5 +79,6 @@ elif [[ "$VERSION" != "$INSTALLED" ]]; then else echo "No need to update!" fi + cp -v /defaults/plexmediaserver /etc/default/plexmediaserver From 90338212f64eaa420be903e8773f292ec07837cd Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 2 Jul 2016 20:28:43 +0100 Subject: [PATCH 05/40] working on plex update script --- root/etc/cont-init.d/30-plex-update | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index bf917e2..3bdf1c6 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -10,7 +10,8 @@ cat > "${NOTOKEN_SET}" <<-EOFTOKEN ##################################################### -# Login via webui and restart, because there was no # +# Login via the webui at http://:32400/web # +# and restart the docker, because there was no # EOFTOKEN # if preferences files doesn't exist, exit out @@ -33,7 +34,7 @@ PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ # if plex token isn't found, exit out if [ -z "$PLEX_TOKEN" ]; then cat >> "${NOTOKEN_SET}" <<-EOFTOKEN -# plex token in the preferences file in config # +# plex token found in the preference file # ##################################################### From 097b6c57ed5d033b87140e8c30a6c93356e41897 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sun, 24 Jul 2016 05:09:20 +0100 Subject: [PATCH 06/40] use variable for initial plex install url --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a2363f..2a84f90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ FROM lsiobase/xenial MAINTAINER Stian Larsen, sparklyballs +# package version +ARG PLEX_WWW="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" + # global environment settings ENV DEBIAN_FRONTEND="noninteractive" ENV HOME="/config" @@ -13,6 +16,7 @@ RUN \ dbus \ less \ wget && \ + # cleanup apt-get clean && \ rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* @@ -21,9 +25,9 @@ RUN \ RUN \ curl -o \ /tmp/plexmediaserver.deb -L \ - 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' && \ + "${PLEX_WWW}" && \ dpkg -i /tmp/plexmediaserver.deb && \ - rm -f /tmp/plexmediaserver.deb + rm -f /tmp/* # add local files COPY root/ / From 3d5fd85f3cdf1dda1cdb57d0014fc6c73b00ce36 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sun, 24 Jul 2016 05:38:27 +0100 Subject: [PATCH 07/40] add check line for download of plex on update --- root/etc/cont-init.d/30-plex-update | 3 ++- root/etc/cont-init.d/40-chown-files | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index 3bdf1c6..ef3a085 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -67,7 +67,7 @@ fi last=130 if [[ "$VERSION" == "" ]]; then - echo "ERROR: No version found, running installed version $INSTALLED" + echo "VERSION variable not set, current installed version $INSTALLED" elif [[ "$VERSION" != "$INSTALLED" ]]; then echo "Upgrading from version: $INSTALLED to version: $VERSION" while [[ $last -ne "0" ]]; do @@ -75,6 +75,7 @@ elif [[ "$VERSION" != "$INSTALLED" ]]; then wget -P /tmp "https://downloads.plex.tv/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" last=$? done + [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && exit 0 apt-get remove --purge -y plexmediaserver dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb else diff --git a/root/etc/cont-init.d/40-chown-files b/root/etc/cont-init.d/40-chown-files index 26405d3..71c1838 100644 --- a/root/etc/cont-init.d/40-chown-files +++ b/root/etc/cont-init.d/40-chown-files @@ -6,7 +6,8 @@ if [ ! -d "/config/Library" ]; then fi if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then - find /config/Library ! \( -user abc -a -group root \) -print0 | xargs -0 chown abc:root + find /config/Library ! \( -user abc -a -group abc \) -print0 | xargs -0 chown abc:abc touch /config/Library/linuxserver-chown.lock + chown abc:abc /config/Library/linuxserver-chown.lock fi From 5b48540a5d703526d9bf34470fd0fcdc45f8a352 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 1 Aug 2016 14:45:26 +0100 Subject: [PATCH 08/40] variable for plex download location, since they have a habit of changing it --- Dockerfile | 3 ++- root/etc/cont-init.d/30-plex-update | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2a84f90..ea45056 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM lsiobase/xenial MAINTAINER Stian Larsen, sparklyballs # package version -ARG PLEX_WWW="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" +ENV PLEX_URL="https://plex.tv/downloads" +ARG PLEX_WWW="${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" # global environment settings ENV DEBIAN_FRONTEND="noninteractive" diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index ef3a085..d19c5ad 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -54,10 +54,10 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then - VERSION=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) + VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) echo "Target version: $VERSION set by: latest\plexpass" elif [[ "$VERSION" = public ]]; then - VERSION=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) + VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) echo "Target version: $VERSION set by: public" elif [[ -z "$VERSION" ]]; then echo "Target version: Version not set, Defaulting to supplied version" @@ -71,8 +71,9 @@ if [[ "$VERSION" == "" ]]; then elif [[ "$VERSION" != "$INSTALLED" ]]; then echo "Upgrading from version: $INSTALLED to version: $VERSION" while [[ $last -ne "0" ]]; do - rm -f /tmp/plexmediaserver_*.deb - wget -P /tmp "https://downloads.plex.tv/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" + rm -f /tmp/plexmediaserver_*.deb + curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \ + "${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" last=$? done [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && exit 0 From d8395b5b240a1c3f6b60845585c3d10ef6fd79ac Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Wed, 3 Aug 2016 13:56:56 +0100 Subject: [PATCH 09/40] add transcode mapping back to the dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ea45056..932c20c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,5 +34,5 @@ RUN \ COPY root/ / # ports and volumes -VOLUME /config +VOLUME /config /transcode EXPOSE 32400 32400/udp 32469 32469/udp 5353/udp 1900/udp From 4373ee6c26ff344186f30ff2928ab8c7a73fa60a Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Wed, 3 Aug 2016 13:58:54 +0100 Subject: [PATCH 10/40] update readme with transcode folder --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 225f056..17f89f2 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ docker create \ -v :/config \ -v :/data/tvshows \ -v :/data/movies \ + -v :/transcode \ linuxserver/plex ``` @@ -32,6 +33,7 @@ docker create \ * `--net=host` - Shares host networking with container, **required**. * `-v /config` - Plex library location. *This can grow very large, 50gb+ is likely for a large collection.* * `-v /data/xyz` - Media goes here. Add as many as needed e.g. `/data/movies`, `/data/tv`, etc. +* `-v /transcode` - Path for transcoding folder, *optional*. * `-e VERSION=latest` - Permits specific version selection e.g. `0.9.12.4.1192-9a47d21`, also supports `public` (this forces plex so stick with ). If left blank, auto update is disabled until set. * `-e PGID=` for for GroupID - see below for explanation * `-e PUID=` for for UserID - see below for explanation From 827a92234aef8e0897485ce55fa00a6bdaf40011 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 09:36:55 +0100 Subject: [PATCH 11/40] less is more, or not as is the case --- Dockerfile | 1 - LICENSE | 675 ++++++++++++++++++++++++++++ root/etc/cont-init.d/30-plex-update | 2 +- 3 files changed, 676 insertions(+), 2 deletions(-) create mode 100644 LICENSE diff --git a/Dockerfile b/Dockerfile index 932c20c..d5e53b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,6 @@ RUN \ apt-get install -y \ avahi-daemon \ dbus \ - less \ wget && \ # cleanup diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..733c072 --- /dev/null +++ b/LICENSE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index d19c5ad..d44fb26 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -22,7 +22,7 @@ cat >> "${NOTOKEN_SET}" <<-EOFTOKEN EOFTOKEN -less /tmp/no-token.nfo +echo "$(cat less /tmp/no-token.nfo)" exit 0 fi From c90bb62612095bde370e6bbe8cbc516d974f40c1 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 09:39:27 +0100 Subject: [PATCH 12/40] fix copy pasta error --- root/etc/cont-init.d/30-plex-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index d44fb26..04b761a 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -22,7 +22,7 @@ cat >> "${NOTOKEN_SET}" <<-EOFTOKEN EOFTOKEN -echo "$(cat less /tmp/no-token.nfo)" +echo "$(cat /tmp/no-token.nfo)" exit 0 fi From 1ed525723552dfb71b037c1332967be46d0c1825 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 12:44:21 +0100 Subject: [PATCH 13/40] more tidying --- Dockerfile | 15 +++++++------ root/etc/cont-init.d/20-dbus | 13 +++++++---- root/etc/cont-init.d/30-plex-update | 34 +++++++++++++++++------------ 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5e53b8..94a1db4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,21 +17,22 @@ RUN \ dbus \ wget && \ -# cleanup - apt-get clean && \ - rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* - # install plex -RUN \ curl -o \ /tmp/plexmediaserver.deb -L \ "${PLEX_WWW}" && \ dpkg -i /tmp/plexmediaserver.deb && \ - rm -f /tmp/* + +# cleanup + apt-get clean && \ + rm -rf \ + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* # add local files COPY root/ / # ports and volumes -VOLUME /config /transcode EXPOSE 32400 32400/udp 32469 32469/udp 5353/udp 1900/udp +VOLUME /config /transcode diff --git a/root/etc/cont-init.d/20-dbus b/root/etc/cont-init.d/20-dbus index fcda4ba..ef94cef 100644 --- a/root/etc/cont-init.d/20-dbus +++ b/root/etc/cont-init.d/20-dbus @@ -1,9 +1,14 @@ #!/usr/bin/with-contenv bash -[[ -e /var/run/dbus/pid ]] && rm -f /var/run/dbus/pid - +# make folders mkdir -p /var/run/dbus -chown messagebus:messagebus /var/run/dbus + +# delete existing pid if found +[[ -e /var/run/dbus/pid ]] && \ + rm -f /var/run/dbus/pid + +# permissions +chown messagebus:messagebus \ + /var/run/dbus dbus-uuidgen --ensure sleep 1 - diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index 04b761a..2d04886 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -1,10 +1,12 @@ #!/usr/bin/with-contenv bash # opt out for autoupdates -[ "$ADVANCED_DISABLEUPDATES" ] && exit 0 +[ "$ADVANCED_DISABLEUPDATES" ] && \ + exit 0 # set header for no preferences/token message -[[ -e /tmp/no-token.nfo ]] && rm /tmp/no-token.nfo +[[ -e /tmp/no-token.nfo ]] && \ + rm /tmp/no-token.nfo NOTOKEN_SET='/tmp/no-token.nfo' cat > "${NOTOKEN_SET}" <<-EOFTOKEN @@ -28,8 +30,8 @@ fi # attempt to read plex token PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ -"/config/Library/Application Support/Plex Media Server/Preferences.xml" \ -| sed "s/\".*//") + "/config/Library/Application Support/Plex Media Server/Preferences.xml" \ + | sed "s/\".*//") # if plex token isn't found, exit out if [ -z "$PLEX_TOKEN" ]; then @@ -39,7 +41,7 @@ cat >> "${NOTOKEN_SET}" <<-EOFTOKEN EOFTOKEN -less /tmp/no-token.nfo +echo "$(cat /tmp/no-token.nfo)" exit 0 fi @@ -49,7 +51,8 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) # start update routine -[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" +[ "$PLEXPASS" ] && \ + echo "PLEXPASS is deprecated, please use VERSION" if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi @@ -67,18 +70,21 @@ fi last=130 if [[ "$VERSION" == "" ]]; then - echo "VERSION variable not set, current installed version $INSTALLED" + echo "VERSION variable not set, current installed version $INSTALLED" elif [[ "$VERSION" != "$INSTALLED" ]]; then - echo "Upgrading from version: $INSTALLED to version: $VERSION" - while [[ $last -ne "0" ]]; do + echo "Upgrading from version: $INSTALLED to version: $VERSION" + while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \ - "${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" - last=$? + "${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" + last=$? done - [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && exit 0 - apt-get remove --purge -y plexmediaserver - dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb + [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && \ + exit 0 + apt-get remove --purge -y \ + plexmediaserver + dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb + else echo "No need to update!" fi From e92f5b104da0f39e5ff16fc68a28e040935b75ff Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 13:20:40 +0100 Subject: [PATCH 14/40] add message box outline for no updates set --- root/etc/cont-init.d/{20-dbus => 30-dbus} | 3 ++- .../cont-init.d/{30-plex-update => 40-plex-update} | 12 ++++++++++-- .../cont-init.d/{40-chown-files => 50-chown-files} | 8 +++----- 3 files changed, 15 insertions(+), 8 deletions(-) rename root/etc/cont-init.d/{20-dbus => 30-dbus} (89%) rename root/etc/cont-init.d/{30-plex-update => 40-plex-update} (86%) rename root/etc/cont-init.d/{40-chown-files => 50-chown-files} (65%) diff --git a/root/etc/cont-init.d/20-dbus b/root/etc/cont-init.d/30-dbus similarity index 89% rename from root/etc/cont-init.d/20-dbus rename to root/etc/cont-init.d/30-dbus index ef94cef..162daa1 100644 --- a/root/etc/cont-init.d/20-dbus +++ b/root/etc/cont-init.d/30-dbus @@ -1,7 +1,8 @@ #!/usr/bin/with-contenv bash # make folders -mkdir -p /var/run/dbus +mkdir -p \ + /var/run/dbus # delete existing pid if found [[ -e /var/run/dbus/pid ]] && \ diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/40-plex-update similarity index 86% rename from root/etc/cont-init.d/30-plex-update rename to root/etc/cont-init.d/40-plex-update index 2d04886..09bffce 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/40-plex-update @@ -1,7 +1,15 @@ #!/usr/bin/with-contenv bash -# opt out for autoupdates -[ "$ADVANCED_DISABLEUPDATES" ] && \ +# set no update message +####################################################### +# Update routine will not run, this is either because # +# you havent set the VERSION variable or have set # +# $ADVANCED_DISABLEUPDATES, for more information, see # +#  # +####################################################### + +# test for no version set or opt out for autoupdates +[[ "$ADVANCED_DISABLEUPDATES" ]] || && \ exit 0 # set header for no preferences/token message diff --git a/root/etc/cont-init.d/40-chown-files b/root/etc/cont-init.d/50-chown-files similarity index 65% rename from root/etc/cont-init.d/40-chown-files rename to root/etc/cont-init.d/50-chown-files index 71c1838..bef9d2a 100644 --- a/root/etc/cont-init.d/40-chown-files +++ b/root/etc/cont-init.d/50-chown-files @@ -1,13 +1,11 @@ #!/usr/bin/with-contenv bash -if [ ! -d "/config/Library" ]; then - mkdir /config/Library - chown abc:abc /config/Library -fi +# check for preferences file and exit out if not found +[[ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]] && \ + exit 0 if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then find /config/Library ! \( -user abc -a -group abc \) -print0 | xargs -0 chown abc:abc touch /config/Library/linuxserver-chown.lock chown abc:abc /config/Library/linuxserver-chown.lock fi - From 49591fc29cdc675b5af1b602d59cd9d2b54c9568 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 13:43:05 +0100 Subject: [PATCH 15/40] move plex chown operation, and change test for it --- root/etc/cont-init.d/40-chown-files | 23 +++++++++++++++++++ root/etc/cont-init.d/50-chown-files | 11 --------- .../{40-plex-update => 50-plex-update} | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 root/etc/cont-init.d/40-chown-files delete mode 100644 root/etc/cont-init.d/50-chown-files rename root/etc/cont-init.d/{40-plex-update => 50-plex-update} (98%) diff --git a/root/etc/cont-init.d/40-chown-files b/root/etc/cont-init.d/40-chown-files new file mode 100644 index 0000000..8579706 --- /dev/null +++ b/root/etc/cont-init.d/40-chown-files @@ -0,0 +1,23 @@ +#!/usr/bin/with-contenv bash + +# check for preferences file, make lock file if not found and exit out +if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then +mkdir -p /config/Library +touch /config/Library/linuxserver-chown.lock +chown abc:abc \ + /config/Library +chown abc:abc \ + /config/Library/linuxserver-chown.lock +exit 0 +fi + +if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then +echo "Possible migration from existing version detected, please be patient while we chown existing files" +echo "This could take some time" +chown abc:abc -R \ + /config/Library +touch /config/Library/linuxserver-chown.lock +chown abc:abc \ + /config/Library/linuxserver-chown.lock +echo "chown operation completed" +fi diff --git a/root/etc/cont-init.d/50-chown-files b/root/etc/cont-init.d/50-chown-files deleted file mode 100644 index bef9d2a..0000000 --- a/root/etc/cont-init.d/50-chown-files +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/with-contenv bash - -# check for preferences file and exit out if not found -[[ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]] && \ - exit 0 - -if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then - find /config/Library ! \( -user abc -a -group abc \) -print0 | xargs -0 chown abc:abc - touch /config/Library/linuxserver-chown.lock - chown abc:abc /config/Library/linuxserver-chown.lock -fi diff --git a/root/etc/cont-init.d/40-plex-update b/root/etc/cont-init.d/50-plex-update similarity index 98% rename from root/etc/cont-init.d/40-plex-update rename to root/etc/cont-init.d/50-plex-update index 09bffce..c41a54b 100644 --- a/root/etc/cont-init.d/40-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -9,7 +9,7 @@ ####################################################### # test for no version set or opt out for autoupdates -[[ "$ADVANCED_DISABLEUPDATES" ]] || && \ +[[ "$ADVANCED_DISABLEUPDATES" ]] && \ exit 0 # set header for no preferences/token message From 09ee572ec57e61495aa85f832c887f6a92c4def5 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:08:55 +0100 Subject: [PATCH 16/40] more and more updates --- README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 17f89f2..05dd40b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) -The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring auto-update on startup, easy user mapping and community support. Find us for support at: +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring easy user mapping and community support. Find us for support at: * [forum.linuxserver.io](https://forum.linuxserver.io) * [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io` * [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! @@ -34,11 +34,13 @@ docker create \ * `-v /config` - Plex library location. *This can grow very large, 50gb+ is likely for a large collection.* * `-v /data/xyz` - Media goes here. Add as many as needed e.g. `/data/movies`, `/data/tv`, etc. * `-v /transcode` - Path for transcoding folder, *optional*. -* `-e VERSION=latest` - Permits specific version selection e.g. `0.9.12.4.1192-9a47d21`, also supports `public` (this forces plex so stick with ). If left blank, auto update is disabled until set. +* `-e VERSION=latest` - Set whether to update plex or not - see Setting up application section. * `-e PGID=` for for GroupID - see below for explanation * `-e PUID=` for for UserID - see below for explanation -*Special note* - If you'd like to run Plex without requiring `--net=host` then you will need the following ports in your `docker create` command: +It is based on ubuntu xenial with s6 overlay, for shell access whilst the container is running do `docker exec -it plex /bin/bash`. + +*Special note* - If you'd like to run Plex without requiring `--net=host` (not recommended) then you will need the following ports in your `docker create` command: ``` -p 32400:32400 \ @@ -60,15 +62,26 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) ``` -## Updates / Monitoring +## Setting up the application +Webui can be found at `:32400/web` + +** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** + +Valid settings for VERSION are:- + ++**latest**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` ++**public**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. ++****: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. + +## Info * Shell access whilst the container is running: `docker exec -it plex /bin/bash` -* Upgrade to the latest version: `docker restart plex` * To monitor the logs of the container in realtime: `docker logs -f plex` +* Upgrade to the latest version (see setting up application setting) : `docker restart plex` -## Changelog +## Versions -+ **30.06.16:** Rebased to xenial and s6 overlay ++ **22.08.16:** Rebased to xenial and s6 overlay + **07.04.16:** removed `/transcode` volume support (upstream Plex change) and modified PlexPass download method to prevent unauthorised usage of paid PMS + **24.09.15:** added optional support for volume transcoding (/transcode), and various typo fixes. + **17.09.15:** Changed to run chmod only once From cf0daf1faa6f44029819b061ae9c2328862778fd Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:10:42 +0100 Subject: [PATCH 17/40] reformat markdown on README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 05dd40b..5c63a93 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ Webui can be found at `:32400/web` Valid settings for VERSION are:- -+**latest**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` -+**public**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. -+****: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ++ **latest**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` ++ **public**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. ++ ****: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ## Info From 5f48db73f3c0adb48bad643e5a9727290ff81311 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:11:44 +0100 Subject: [PATCH 18/40] reformat markdown on README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5c63a93..8c89949 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ Webui can be found at `:32400/web` Valid settings for VERSION are:- -+ **latest**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` -+ **public**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. -+ ****: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ++ **`latest`**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` ++ **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. ++ **``**: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ## Info From c7b54885b0885382d178483529b166b1bfab4a52 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:25:21 +0100 Subject: [PATCH 19/40] edits to README --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c89949..4e0bf30 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,15 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel Webui can be found at `:32400/web` ** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** +** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from., to update, restart the docker after logging in through the webui** Valid settings for VERSION are:- -+ **`latest`**: will update plex to the latest version available that you are entitled to. `NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` +`NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` + ++ **`latest`**: will update plex to the latest version available that you are entitled to. + **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. -+ **``**: will select a specific version of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ++ **``**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ## Info From 9bf362c0bbf82e1722fdf1e6b92e76dd05e0ff12 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:26:27 +0100 Subject: [PATCH 20/40] reformat markdown on README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e0bf30..8fc3636 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel Webui can be found at `:32400/web` ** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** + ** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from., to update, restart the docker after logging in through the webui** Valid settings for VERSION are:- @@ -74,7 +75,7 @@ Valid settings for VERSION are:- + **`latest`**: will update plex to the latest version available that you are entitled to. + **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. -+ **``**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions, if you do not have plexpass. ++ **``**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass. ## Info From cbb2c00497889b2861f88aeeed80af685631165a Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:30:23 +0100 Subject: [PATCH 21/40] edits to README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8fc3636..4ded0dd 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,11 @@ Webui can be found at `:32400/web` ** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** -** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from., to update, restart the docker after logging in through the webui** +** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update, restart the docker after logging in through the webui** Valid settings for VERSION are:- -`NOTE YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` +`IMPORTANT NOTE:- YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` + **`latest`**: will update plex to the latest version available that you are entitled to. + **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. From f1cdb88e51c2fa05b56aecf96d3e57fe9a4232dd Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 14:32:25 +0100 Subject: [PATCH 22/40] tone down the commas in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4ded0dd..08d564c 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,14 @@ Webui can be found at `:32400/web` ** Note about updates, if there is no value set for the VERSION variable, then no updates will take place.** -** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update, restart the docker after logging in through the webui** +** For new users, no updates will take place on the first run of the container as there is no preferences file to read your token from, to update restart the docker after logging in through the webui** Valid settings for VERSION are:- `IMPORTANT NOTE:- YOU CANNOT UPDATE TO A PLEXPASS ONLY VERSION IF YOU DO NOT HAVE PLEXPASS` + **`latest`**: will update plex to the latest version available that you are entitled to. -+ **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge, but still want the latest public updates. ++ **`public`**: will update plexpass users to the latest public version, useful for plexpass users that don't want to be on the bleeding edge but still want the latest public updates. + **``**: will select a specific version (eg 0.9.12.4.1192-9a47d21) of plex to install, note you cannot use this to access plexpass versions if you do not have plexpass. ## Info From 6dc05aafbc22fd34c47627c47afe1748a3e207af Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 19:26:13 +0100 Subject: [PATCH 23/40] refined update script, not tested the logic fully yet --- root/etc/cont-init.d/50-plex-update | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index c41a54b..a988440 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -1,16 +1,24 @@ #!/usr/bin/with-contenv bash # set no update message +[[ -e /tmp/no-version.nfo ]] && \ + rm /tmp/no-version.nfo +NOVERSION_SET='/tmp/no-version.nfo' +cat > "${NOVERSION_SET}" <<-EOFVERSION + + ####################################################### -# Update routine will not run, this is either because # -# you havent set the VERSION variable or have set # -# $ADVANCED_DISABLEUPDATES, for more information, see # -#  # +# Update routine will not run because you havent set # +# the VERSION variable, for more information checkout # +#  https://github.com/linuxserver/docker-plex # ####################################################### +EOFVERSION # test for no version set or opt out for autoupdates -[[ "$ADVANCED_DISABLEUPDATES" ]] && \ - exit 0 +if [[ -z "$VERSION" ]] || [[ "$VERSION"=="0" ]] || [ "$ADVANCED_DISABLEUPDATES" ]; then +echo "$(cat /tmp/no-version.nfo)" +exit 0 +fi # set header for no preferences/token message [[ -e /tmp/no-token.nfo ]] && \ @@ -59,27 +67,23 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) # start update routine -[ "$PLEXPASS" ] && \ +[[ "$PLEXPASS" ]] && \ echo "PLEXPASS is deprecated, please use VERSION" -if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi +if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is deprecated please use version latest"; fi if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) - echo "Target version: $VERSION set by: latest\plexpass" + echo "Target version: $VERSION set to: latest\plexpass" elif [[ "$VERSION" = public ]]; then VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) - echo "Target version: $VERSION set by: public" -elif [[ -z "$VERSION" ]]; then - echo "Target version: Version not set, Defaulting to supplied version" + echo "Target version: $VERSION set to: public" else - echo "Target version: $VERSION set by: manually" + echo "Target version: $VERSION set to: manual" fi last=130 -if [[ "$VERSION" == "" ]]; then - echo "VERSION variable not set, current installed version $INSTALLED" -elif [[ "$VERSION" != "$INSTALLED" ]]; then +if [[ "$VERSION" != "$INSTALLED" ]]; then echo "Upgrading from version: $INSTALLED to version: $VERSION" while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb @@ -98,4 +102,3 @@ else fi cp -v /defaults/plexmediaserver /etc/default/plexmediaserver - From da12aa2d6331f6923c6f1aa6e45efe3f3b95c58a Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 20:09:31 +0100 Subject: [PATCH 24/40] improve logic on test for no update --- root/etc/cont-init.d/50-plex-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index a988440..fc6acbe 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -15,7 +15,7 @@ cat > "${NOVERSION_SET}" <<-EOFVERSION EOFVERSION # test for no version set or opt out for autoupdates -if [[ -z "$VERSION" ]] || [[ "$VERSION"=="0" ]] || [ "$ADVANCED_DISABLEUPDATES" ]; then +if [ -z "$VERSION" -o "$VERSION" == "0" -o ! -z "$ADVANCED_DISABLEUPDATES" ]; then echo "$(cat /tmp/no-version.nfo)" exit 0 fi From 78f96a9629d7cb284b83c47d091aaa3086058a08 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 20:41:24 +0100 Subject: [PATCH 25/40] still working on update script --- root/etc/cont-init.d/50-plex-update | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index fc6acbe..2791d55 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -15,8 +15,8 @@ cat > "${NOVERSION_SET}" <<-EOFVERSION EOFVERSION # test for no version set or opt out for autoupdates -if [ -z "$VERSION" -o "$VERSION" == "0" -o ! -z "$ADVANCED_DISABLEUPDATES" ]; then -echo "$(cat /tmp/no-version.nfo)" +if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ ! -z "$ADVANCED_DISABLEUPDATES" ]]; then +printf "%s\n\n\n" "$(> "${NOTOKEN_SET}" <<-EOFTOKEN # preference file found, possibly first startup. # ##################################################### - - EOFTOKEN -echo "$(cat /tmp/no-token.nfo)" +printf "%s\n\n\n" "$(> "${NOTOKEN_SET}" <<-EOFTOKEN # plex token found in the preference file # ##################################################### - - EOFTOKEN -echo "$(cat /tmp/no-token.nfo)" +printf "%s\n\n\n" "$( Date: Mon, 22 Aug 2016 22:02:36 +0100 Subject: [PATCH 26/40] save up for prosperity, no comment on completion or viability, just a save up --- Dockerfile | 1 + root/etc/cont-init.d/50-plex-update | 45 +++++++++++++---------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94a1db4..4d526d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN \ # cleanup apt-get clean && \ rm -rf \ + /etc/default/plexmediaserver \ /tmp/* \ /var/lib/apt/lists/* \ /var/tmp/* diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 2791d55..e36afb9 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -1,8 +1,12 @@ #!/usr/bin/with-contenv bash +# copy config on first run, regardless of update status +[[ ! -e /etc/default/plexmediaserver ]] && \ + cp /defaults/plexmediaserver /etc/default/plexmediaserver + # set no update message [[ -e /tmp/no-version.nfo ]] && \ - rm /tmp/no-version.nfo + rm /tmp/no-version.nfo NOVERSION_SET='/tmp/no-version.nfo' cat > "${NOVERSION_SET}" <<-EOFVERSION @@ -61,39 +65,30 @@ fi INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) # start update routine - -[[ "$PLEXPASS" ]] && \ - echo "PLEXPASS is deprecated, please use VERSION" - -if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is deprecated please use version latest"; fi - -if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then - VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) - echo "Target version: $VERSION" -elif [[ "$VERSION" = public ]]; then - VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) - echo "Target version: $VERSION" +if [[ "$VERSION" = latest ]] || [[ "$VERSION" = plexpass ]] || [[ "$PLEXPASS" == "1" ]]; then +PLEX_TOKEN="${PLEX_TOKEN}" else - echo "Target version: $VERSION" +PLEX_TOKEN="" fi +VERSION=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) +if [[ "$VERSION" == "$INSTALLED" ]]; then +echo "No update required" +exit 0 +fi + +echo "Atempting to upgrade to: $VERSION" last=130 -if [[ "$VERSION" != "$INSTALLED" ]]; then - echo "Upgrading from version: $INSTALLED to version: $VERSION" - while [[ $last -ne "0" ]]; do +while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \ "${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" last=$? - done - [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && \ - exit 0 +done apt-get remove --purge -y \ plexmediaserver - dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb - rm -f /tmp/plexmediaserver_*.deb -else - echo "No updates found!" -fi +dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb +rm -f /tmp/plexmediaserver_*.deb +# recopy config file in case update overwrites our copy cp -v /defaults/plexmediaserver /etc/default/plexmediaserver From d8e00e7debcee8b75481b0addb0f012b05b0459b Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 22 Aug 2016 22:47:27 +0100 Subject: [PATCH 27/40] tweak the printf in update --- root/etc/cont-init.d/50-plex-update | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index e36afb9..5d8f195 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -9,18 +9,17 @@ rm /tmp/no-version.nfo NOVERSION_SET='/tmp/no-version.nfo' cat > "${NOVERSION_SET}" <<-EOFVERSION - - ####################################################### # Update routine will not run because you havent set # -# the VERSION variable, for more information checkout # +# the VERSION variable or you opted out of updates. # +# For more information checkout :- # #  https://github.com/linuxserver/docker-plex # ####################################################### EOFVERSION # test for no version set or opt out for autoupdates if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ ! -z "$ADVANCED_DISABLEUPDATES" ]]; then -printf "%s\n\n\n" "$( "${NOTOKEN_SET}" <<-EOFTOKEN - - ##################################################### # Login via the webui at http://:32400/web # # and restart the docker, because there was no # @@ -42,7 +39,7 @@ cat >> "${NOTOKEN_SET}" <<-EOFTOKEN # preference file found, possibly first startup. # ##################################################### EOFTOKEN -printf "%s\n\n\n" "$(> "${NOTOKEN_SET}" <<-EOFTOKEN # plex token found in the preference file # ##################################################### EOFTOKEN -printf "%s\n\n\n" "$( Date: Tue, 23 Aug 2016 01:06:29 +0100 Subject: [PATCH 28/40] correct README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08d564c..3792aae 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Valid settings for VERSION are:- * Shell access whilst the container is running: `docker exec -it plex /bin/bash` * To monitor the logs of the container in realtime: `docker logs -f plex` -* Upgrade to the latest version (see setting up application setting) : `docker restart plex` +* Upgrade to the latest version (see setting up application section) : `docker restart plex` ## Versions From b34d77d1fcb7d8d102188c6e42b2e3cf5eccd2b9 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 02:32:22 +0100 Subject: [PATCH 29/40] refine update script, attempt at better error control --- Dockerfile | 5 ++-- root/etc/cont-init.d/50-plex-update | 45 ++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d526d9..5440813 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,12 @@ MAINTAINER Stian Larsen, sparklyballs # package version ENV PLEX_URL="https://plex.tv/downloads" -ARG PLEX_WWW="${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" +ENV PLEX_INSTALL="${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" # global environment settings ENV DEBIAN_FRONTEND="noninteractive" ENV HOME="/config" +ENV PLEX_WWW="${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN" # install packages RUN \ @@ -20,7 +21,7 @@ RUN \ # install plex curl -o \ /tmp/plexmediaserver.deb -L \ - "${PLEX_WWW}" && \ + "${PLEX_INSTALL}" && \ dpkg -i /tmp/plexmediaserver.deb && \ # cleanup diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 5d8f195..62dd7d6 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -17,6 +17,20 @@ cat > "${NOVERSION_SET}" <<-EOFVERSION ####################################################### EOFVERSION +# set update failed message +[[ -e /tmp/update_fail.nfo ]] && \ + rm /tmp/update_fail.nfo +UPGRADE_FAIL='/tmp/update_fail.nfo' +cat > "${UPGRADE_FAIL}" <<-EOFFAIL +######################################################## +# Upgrade attempt failed, this could be because either # +# plex update site is down, local network issues, or # +# you were trying to get a version that simply doesn't # +# exist, check over the VERSION variable thoroughly & # +# correct it or try again later. # +######################################################## +EOFFAIL + # test for no version set or opt out for autoupdates if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ ! -z "$ADVANCED_DISABLEUPDATES" ]]; then printf "\n\n\n%s\n\n\n" "$( Date: Tue, 23 Aug 2016 03:47:23 +0100 Subject: [PATCH 30/40] haven't quite sorted out better download error handling --- root/etc/cont-init.d/50-plex-update | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 62dd7d6..d53410b 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -92,15 +92,16 @@ fi echo "Atempting to upgrade to: $REMOTE_VERSION" last=130 -down_tries=3 -if curl --output /dev/null --silent --head --fail "${PLEX_URL}/plex-media-server/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb"; then -while [[ $last -ne "0" ]] || [[ down_tries -gt 0 ]]; do +down_tries=0 +while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb curl -o /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb -L \ - "${PLEX_URL}/plex-media-server/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb" - down_tries=$((down_tries-1)) -last=$? + "${PLEX_URL}/plex-media-server/${REMOTE_VERSION}/plexmediaserver_${REMOTE_VERSION}_amd64.deb" + last=$? done + +# test if deb exists, install it or exit out +if [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb) -gt 10000 ]]; then apt-get remove --purge -y \ plexmediaserver dpkg -i /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb From 892c17b0b8226ef9c6e9e6cf170b2974d0c93230 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 08:57:18 +0100 Subject: [PATCH 31/40] correcting locations, would be just bloody dandy if plex had some semblance of consistency in it's locations --- Dockerfile | 5 ++--- root/etc/cont-init.d/50-plex-update | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5440813..73a4632 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,12 @@ FROM lsiobase/xenial MAINTAINER Stian Larsen, sparklyballs # package version -ENV PLEX_URL="https://plex.tv/downloads" -ENV PLEX_INSTALL="${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" +ENV PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" # global environment settings ENV DEBIAN_FRONTEND="noninteractive" ENV HOME="/config" -ENV PLEX_WWW="${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN" +ENV PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" # install packages RUN \ diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index d53410b..f0b429c 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -77,10 +77,10 @@ INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' plexmediaserver) # start update routine if [[ "$VERSION" = latest ]] || [[ "$VERSION" = plexpass ]] || [[ "$PLEXPASS" == "1" ]]; then -REMOTE_VERSION=$(curl -s "${PLEX_WWW}"| cut -d "/" -f 5 ) +REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) elif [[ "$VERSION" = public ]]; then PLEX_TOKEN="" -REMOTE_VERSION=$(curl -s "${PLEX_WWW}"| cut -d "/" -f 5 ) +REMOTE_VERSION=$(curl -s "${PLEX_INSTALL}&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) else REMOTE_VERSION="${VERSION}" fi @@ -92,12 +92,11 @@ fi echo "Atempting to upgrade to: $REMOTE_VERSION" last=130 -down_tries=0 while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb curl -o /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb -L \ - "${PLEX_URL}/plex-media-server/${REMOTE_VERSION}/plexmediaserver_${REMOTE_VERSION}_amd64.deb" - last=$? + "${PLEX_DOWNLOAD}/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb" +last=$? done # test if deb exists, install it or exit out From b1b4525756dbe2b71dcb674ffa4f1caa9b420e63 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 10:01:37 +0100 Subject: [PATCH 32/40] real belt and braches stuff here, trying to cover every possible base though, who cares if the script is a mile long, as long as the user doesn't end up with a borked system --- root/etc/cont-init.d/50-plex-update | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index f0b429c..6faffdd 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -91,24 +91,24 @@ exit 0 fi echo "Atempting to upgrade to: $REMOTE_VERSION" -last=130 -while [[ $last -ne "0" ]]; do - rm -f /tmp/plexmediaserver_*.deb - curl -o /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb -L \ - "${PLEX_DOWNLOAD}/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb" +rm -f /tmp/plexmediaserver_*.deb +wget -nv -P /tmp \ +"${PLEX_DOWNLOAD}/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb" last=$? -done -# test if deb exists, install it or exit out -if [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb) -gt 10000 ]]; then - apt-get remove --purge -y \ - plexmediaserver -dpkg -i /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb -rm -f /tmp/plexmediaserver_*.deb -else +# test if deb file size is ok, or if download failed +if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb) -lt 10000 ]]; then printf "\n\n\n%s\n\n\n" "$( /dev/null 2>&1 || \ +(echo "for some reason the update has failed and plex doesn't seem to be installed, retrying a known version" && curl -o /tmp/plexmediaserver.deb -L "${PLEX_INSTALL}" && dpkg -i /tmp/plexmediaserver.deb) + # recopy config file in case update overwrites our copy -cp -v /defaults/plexmediaserver /etc/default/plexmediaserver +cp /defaults/plexmediaserver /etc/default/plexmediaserver From 77f0ea604917be4a3a65963204c05000fb437e12 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 10:10:39 +0100 Subject: [PATCH 33/40] real belt and braches stuff here, trying to cover every possible base though, who cares if the script is a mile long, as long as the user doesn't end up with a borked system --- root/etc/cont-init.d/50-plex-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 6faffdd..e93ad04 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -102,7 +102,7 @@ printf "\n\n\n%s\n\n\n" "$( Date: Tue, 23 Aug 2016 12:29:39 +0100 Subject: [PATCH 34/40] move test for plex installed to top of update script, change dpkg options --- root/etc/cont-init.d/50-plex-update | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index e93ad04..219a78f 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -4,6 +4,17 @@ [[ ! -e /etc/default/plexmediaserver ]] && \ cp /defaults/plexmediaserver /etc/default/plexmediaserver +# test if plex is installed and try re-pulling latest if not +if dpkg -s plexmediaserver > /dev/null 2>&1 ; then +: +else echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script" +curl -o /tmp/plexmediaserver.deb -L \ + "${PLEX_INSTALL}" && \ +dpkg -i --force-confold /tmp/plexmediaserver.deb +rm -f /tmp/plexmediaserver.deb +exit 0 +fi + # set no update message [[ -e /tmp/no-version.nfo ]] && \ rm /tmp/no-version.nfo @@ -102,13 +113,9 @@ printf "\n\n\n%s\n\n\n" "$( /dev/null 2>&1 || \ -(echo "for some reason the update has failed and plex doesn't seem to be installed, retrying a known version" && curl -o /tmp/plexmediaserver.deb -L "${PLEX_INSTALL}" && dpkg -i /tmp/plexmediaserver.deb) - -# recopy config file in case update overwrites our copy +# recopy config file cp /defaults/plexmediaserver /etc/default/plexmediaserver From 7fd2f7f57469aeb0c0ebd3b91785e1785a6b5e01 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 17:06:38 +0100 Subject: [PATCH 35/40] better test for package installed or not. --- root/etc/cont-init.d/50-plex-update | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 219a78f..5bb040b 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -2,14 +2,15 @@ # copy config on first run, regardless of update status [[ ! -e /etc/default/plexmediaserver ]] && \ - cp /defaults/plexmediaserver /etc/default/plexmediaserver + cp /defaults/plexmediaserver /etc/default/plexmediaserver # test if plex is installed and try re-pulling latest if not -if dpkg -s plexmediaserver > /dev/null 2>&1 ; then +if (dpkg --get-selections plexmediaserver | grep -wq "install"); then : -else echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script" +else +echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script" curl -o /tmp/plexmediaserver.deb -L \ - "${PLEX_INSTALL}" && \ + "${PLEX_INSTALL}" && \ dpkg -i --force-confold /tmp/plexmediaserver.deb rm -f /tmp/plexmediaserver.deb exit 0 @@ -17,7 +18,7 @@ fi # set no update message [[ -e /tmp/no-version.nfo ]] && \ - rm /tmp/no-version.nfo + rm /tmp/no-version.nfo NOVERSION_SET='/tmp/no-version.nfo' cat > "${NOVERSION_SET}" <<-EOFVERSION ####################################################### @@ -30,7 +31,7 @@ EOFVERSION # set update failed message [[ -e /tmp/update_fail.nfo ]] && \ - rm /tmp/update_fail.nfo + rm /tmp/update_fail.nfo UPGRADE_FAIL='/tmp/update_fail.nfo' cat > "${UPGRADE_FAIL}" <<-EOFFAIL ######################################################## @@ -50,7 +51,7 @@ fi # set header for no preferences/token message [[ -e /tmp/no-token.nfo ]] && \ - rm /tmp/no-token.nfo + rm /tmp/no-token.nfo NOTOKEN_SET='/tmp/no-token.nfo' cat > "${NOTOKEN_SET}" <<-EOFTOKEN ##################################################### @@ -70,8 +71,8 @@ fi # attempt to read plex token PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ - "/config/Library/Application Support/Plex Media Server/Preferences.xml" \ - | sed "s/\".*//") + "/config/Library/Application Support/Plex Media Server/Preferences.xml" \ + | sed "s/\".*//") # if plex token isn't found, exit out if [ -z "$PLEX_TOKEN" ]; then From 450947da68c0a956ee638983626ae90bcdc7cd1e Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 27 Aug 2016 14:15:12 +0100 Subject: [PATCH 36/40] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3792aae..1b376f5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,10 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another container r # linuxserver/plex -[![](https://badge.imagelayers.io/linuxserver/plex:latest.svg)](https://imagelayers.io/?images=linuxserver/plex:latest 'Get your own badge on imagelayers.io') + +[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/plex.svg)][hub] +[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/plex.svg)][hub] +[hub]: https://hub.docker.com/r/linuxserver/plex/ [Plex](https://plex.tv/) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. From 4d171be6a65d28c35791d6a78d9e484f9405fa0f Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 27 Aug 2016 14:23:22 +0100 Subject: [PATCH 37/40] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b376f5..5b5011e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another container r [Plex](https://plex.tv/) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. -![https://plex.tv](http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250 "Plex logo") +!(http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)[https://plex.tv] ## Usage From 83b1303649719c9cdbe29e07d4681085dd7065f8 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 27 Aug 2016 14:24:44 +0100 Subject: [PATCH 38/40] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b5011e..4e23205 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another container r [Plex](https://plex.tv/) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. -!(http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)[https://plex.tv] +![https://plex.tv](http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)[plexurl] +[plexurl]: https://plex.tv ## Usage From a0435fe22b2e12166ac2c2ba6fd450552aa32ed2 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 27 Aug 2016 14:26:34 +0100 Subject: [PATCH 39/40] Update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e23205..9c991ee 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another container r [Plex](https://plex.tv/) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. -![https://plex.tv](http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)[plexurl] +[![plex](http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)][plexurl] [plexurl]: https://plex.tv ## Usage From bcdcb306456804e9f3685f90989efdcd68c1d48a Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sat, 27 Aug 2016 14:27:55 +0100 Subject: [PATCH 40/40] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c991ee..dced75f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another container r [Plex](https://plex.tv/) organizes video, music and photos from personal media libraries and streams them to smart TVs, streaming boxes and mobile devices. This container is packaged as a standalone Plex Media Server. -[![plex](http://i2.wp.com/moonbooks.net/wp-content/uploads/2014/12/plex-logo-dark-small-77202045f47146129647bee8b1cac77c.png?resize=770%2C250)][plexurl] +[![plex](http://the-gadgeteer.com/wp-content/uploads/2015/10/plex-logo-e1446990678679.png)][plexurl] [plexurl]: https://plex.tv ## Usage