@@ -128,28 +128,35 @@ fn auto_pick_rootfs(
128128 theme : & dyn dialoguer:: theme:: Theme ,
129129 arch : & str ,
130130) -> Result < ( String , Option < String > , bool ) > {
131- let root = pick_latest_rootfs ( arch) ;
131+ match pick_latest_rootfs ( arch) {
132+ Ok ( rootfs) => {
133+ info ! (
134+ "Ciel has picked buildkit for {}, released on {}" ,
135+ rootfs. arch, rootfs. date
136+ ) ;
137+ Ok ( (
138+ format ! ( "https://releases.aosc.io/{}" , rootfs. path) ,
139+ Some ( rootfs. sha256sum ) ,
140+ false ,
141+ ) )
142+ }
143+ Err ( e) => {
144+ if let Some ( e) = e. downcast_ref :: < ureq:: Error > ( ) {
145+ error ! ( "Failed to fetch manifest: {}" , e) ;
146+ std:: process:: exit ( 1 ) ;
147+ }
132148
133- if let Ok ( rootfs) = root {
134- info ! (
135- "Ciel has picked buildkit for {}, released on {}" ,
136- rootfs. arch, rootfs. date
137- ) ;
138- Ok ( (
139- format ! ( "https://releases.aosc.io/{}" , rootfs. path) ,
140- Some ( rootfs. sha256sum ) ,
141- false ,
142- ) )
143- } else {
144- warn ! (
145- "Ciel was unable to find a suitable buildkit release. Please specify the URL manually."
146- ) ;
147- let rootfs_url = Input :: < String > :: with_theme ( theme)
148- . with_prompt ( "Rootfs URL" )
149- . interact_text ( ) ?;
149+ warn ! (
150+ "Ciel was unable to find a suitable buildkit release. Please specify the URL manually."
151+ ) ;
150152
151- let use_tarball = !rootfs_url. ends_with ( ".squashfs" ) ;
153+ let rootfs_url = Input :: < String > :: with_theme ( theme)
154+ . with_prompt ( "Rootfs URL" )
155+ . interact_text ( ) ?;
152156
153- Ok ( ( rootfs_url, None , use_tarball) )
157+ let use_tarball = !rootfs_url. ends_with ( ".squashfs" ) ;
158+
159+ Ok ( ( rootfs_url, None , use_tarball) )
160+ }
154161 }
155162}
0 commit comments