{"id":573,"date":"2022-11-06T22:50:02","date_gmt":"2022-11-06T22:50:02","guid":{"rendered":"https:\/\/gentoostudio.org\/?p=573"},"modified":"2022-11-12T22:17:29","modified_gmt":"2022-11-12T22:17:29","slug":"new-code-for-tarball-automation","status":"publish","type":"post","link":"https:\/\/dev.decibellinux.org\/?p=573","title":{"rendered":"New code for tarball automation"},"content":{"rendered":"\n<p>Today I jotted down some fresh code for tarball automation. The needs of such automation are so simple it made sense to write it in bash. I thought I&#8217;d share it here. Suggestions are always welcome. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\n\n### PART 1: UPDATE SEED\n\n# Get text file describing latest stage3 tarball.\n# -O option circumvents wget creating a new file on every run and gives us a fixed filename to use.\n# The wget -S option is --server-response, which can be grepped.\n# ssmtp.conf has been configured.\nurl=\"https:\/\/distfiles.gentoo.org\/releases\/amd64\/autobuilds\/latest-stage3-amd64-desktop-systemd.txt\"\nemail=\"webmaster@gentoostudio.org\"\nif &#91;&#91; `wget -S --spider $url  2&gt;&amp;1 | grep 'HTTP\/1.1 200 OK'` ]];\n        then wget -O latest.txt $url;\n        else\n                ssmtp -v $email &lt; wget_textfile_failmsg\n                echo \"Remote file does not exist. Mail sent to $email.\"\n                exit 1;\nfi\n\n# Parse text file for URL\n# Use tail cmd to read last line of file, which is all we need,\n# then use sed to chop off everything after the space in that line\n# When wget is done, move the file to where its needed\n# (The mv destination is a symlink)\n# Not sure we need an ifelse here. If the above check passes, this wget should work.\nlatest=$(tail -n 1 latest.txt | sed 's#&#91;&#91;:space:]].*##')\nwget -O stage3seed.tar.xz https:\/\/distfiles.gentoo.org\/releases\/amd64\/autobuilds\/$latest\nmv stage3seed.tar.xz catalyst-tarballs\n\n### PART 2: SYNC\n\neix-sync\ncatalyst -s latest\n\n### PART 3: STAGE1 BUILD\n\ncatalyst -af stage1.spec\n# TODO: Error detection and mail notification\n\n### PART 4: STAGE2 BUILD\n\ncatalyst -af stage2.spec\n# TODO: Error detection and mail notification\n\n### PART 5: STAGE3 BUILD\n\ncatalyst -af stage3.spec\n# TODO: Error detection and mail notification\n\n### PART 6: STAGE4 BUILD\n\ncatalysst -af stage4.spec\n# TODO: Error detection and mail notification\n\n### fscript is automatically executed by stage4.\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today I jotted down some fresh code for tarball automation. The needs of such automation are so simple it made sense to write it in bash. I thought I&#8217;d share it here. Suggestions are always welcome. #!\/bin\/sh ### PART 1: UPDATE SEED # Get text file describing latest stage3 tarball. # -O option circumvents wget&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/dev.decibellinux.org\/?p=573\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,8],"tags":[],"class_list":["post-573","post","type-post","status-publish","format-standard","hentry","category-blog","category-blog-catalyst-automation"],"_links":{"self":[{"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/posts\/573"}],"collection":[{"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=573"}],"version-history":[{"count":2,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions"}],"predecessor-version":[{"id":575,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions\/575"}],"wp:attachment":[{"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.decibellinux.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}