Merge lp:~nik90/component-store/improve-ucs-script into lp:component-store

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 35
Proposed branch: lp:~nik90/component-store/improve-ucs-script
Merge into: lp:component-store
Diff against target: 142 lines (+50/-26)
2 files modified
script/debian/changelog (+8/-0)
script/ucs (+42/-26)
To merge this branch: bzr merge lp:~nik90/component-store/improve-ucs-script
Reviewer Review Type Date Requested Status
Ubuntu Touch Community Dev Pending
Review via email: mp+241211@code.launchpad.net

Commit message

- Fixed typos in the help command
- Improved install and update command to use less network bandwidth

Description of the change

- Fixed typos in the help command
- Improved install and update command to use less network bandwidth

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'script/debian/changelog'
2--- script/debian/changelog 2014-11-08 23:03:50 +0000
3+++ script/debian/changelog 2014-11-09 15:39:04 +0000
4@@ -1,3 +1,11 @@
5+ucs (0.1.2) trusty; urgency=medium
6+
7+ * Improved install and update command to use less network bandwidth by only
8+ downloading the necessary components.
9+ * Fixed some typos in the help command.
10+
11+ -- Nekhelesh Ramananthan <krnekhelesh@gmail.com> Sun, 09 Nov 2014 16:36:31 +0100
12+
13 ucs (0.1.1) trusty; urgency=medium
14
15 * Fixed install path to usr/bin
16
17=== modified file 'script/ucs'
18--- script/ucs 2014-11-08 22:37:17 +0000
19+++ script/ucs 2014-11-09 15:39:04 +0000
20@@ -4,6 +4,7 @@
21 PWD=$(pwd)
22 ARGS=("$@")
23 UCS_BRANCH=lp:component-store
24+UCS_FILEPATH=lp:~ubuntu-touch-community-dev/component-store/trunk.14.10/ComponentStore
25 BOOTSTRAP_FOLDER=${PWD}/ComponentStoreSetup
26
27 # Color Output
28@@ -12,13 +13,14 @@
29 NC='\e[0m'
30
31 show_usage() {
32- echo "Usage: $0 [OPTION].. [OTHER ARGUMENTS]"
33+ echo "Usage:"
34+ echo " ucs <command> [options]"
35 echo ""
36- echo "options:"
37- echo -e "\tinstall [COMPONENT]\tInstall Component"
38- echo -e "\tupdate [COMPONENT]\tUpdate Component"
39- echo -e "\thelp \tdisplay this help and exit"
40- echo -e "\tversion \toutput version information and exit"
41+ echo "Commands:"
42+ echo -e " install \tInstall Components"
43+ echo -e " update \tUpdate Components"
44+ echo -e " help \tdisplay this help and exit"
45+ echo -e " version \toutput version information and exit"
46 }
47
48 install_prerequisites() {
49@@ -41,59 +43,73 @@
50
51 #CASE: ABOUT ARGUMENT
52 elif [[ $1 == "version" ]]; then
53- echo "Ubuntu Component Store (UCS) v0.1"
54+ echo "Ubuntu Component Store (UCS) v0.1.2"
55 echo "Copyright (C) 2014 Ubuntu Touch Community Dev Team"
56 echo "License GPLv3: GNU version 3 <http://gnu.org/licenses/gpl.html>."
57 echo "This is free software: you are free to change and redistribute it."
58 echo "There is NO WARRANTY, to the extent permitted by law."
59 echo
60- echo "Written by Nekhelesh Ramananthan"
61+ echo "Written by Ubuntu Touch Community Dev"
62 exit 0
63
64 #CASE: INSTALL ARGUMENT
65 elif [[ $1 == "install" ]]; then
66 install_prerequisites
67- echo "Grabbing the latest upstream code..."
68- bzr branch -q $UCS_BRANCH $BOOTSTRAP_FOLDER
69 if [ $# -gt 1 ]; then
70 for (( i=1; i<$#; i++ ))
71 do
72- if [ -d $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]} ]; then
73- echo -e "Installing ${ARGS[$i]}...${GC}DONE${NC}"
74- mv $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]}/* ${PWD}
75+ echo -n "[$i/`expr $# - 1`] Installing ${ARGS[$i]}..."
76+ componentfilelist=(`bzr ls -q $UCS_FILEPATH/${ARGS[$i]}`)
77+ componentfilelistcount=${#componentfilelist[@]}
78+ if (( componentfilelistcount == 0 )); then
79+ echo -e "${RC}FAILED${NC} (Invalid component name)"
80 else
81- echo -e "Installing ${ARGS[$i]}...${RC}FAILED${NC} (Invalid component name)"
82+ for (( j=0; j<componentfilelistcount; j++ ))
83+ do
84+ filename=$(basename ${componentfilelist[j]})
85+ bzr cat -q ${componentfilelist[j]} > ${PWD}/${filename}
86+ done
87+ echo -e "${GC}DONE${NC}"
88 fi
89 done
90 else
91- echo -e "Installing all components...${GC}DONE${NC}"
92- componentlist=(`ls $BOOTSTRAP_FOLDER/ComponentStore`)
93+ echo -n "Installing all components..."
94+ componentlist=(`bzr ls -q $UCS_FILEPATH`)
95 componentlistcount=${#componentlist[@]}
96 for (( i=0; i<componentlistcount; i++ ))
97 do
98- mv $BOOTSTRAP_FOLDER/ComponentStore/${componentlist[i]}/* ${PWD}
99+ componentfilelist=(`bzr ls -q ${componentlist[i]}`)
100+ componentfilelistcount=${#componentfilelist[@]}
101+ for (( j=0; j<componentfilelistcount; j++ ))
102+ do
103+ bzr cat -q ${componentlist[i]}${componentfilelist[j]} > ${PWD}/${componentfilelist[j]}
104+ done
105 done
106+ echo -e "${GC}DONE${NC}"
107 fi
108- rm -r $BOOTSTRAP_FOLDER
109 echo -e "${GC}Installation Complete!${NC}"
110
111 #CASE: UPDATE ARGUMENT
112 elif [[ $1 == "update" ]]; then
113 if [ $# -gt 1 ]; then
114- echo "Grabbing the latest upstream code..."
115- bzr branch -q $UCS_BRANCH $BOOTSTRAP_FOLDER
116 for (( i=1; i<$#; i++ ))
117 do
118- if [ -d $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]} ]; then
119- echo -e "Updating ${ARGS[$i]}...${GC}DONE${NC}"
120- mv $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]}/* ${PWD}
121+ echo -n "[$i/`expr $# - 1`] Updating ${ARGS[$i]}..."
122+ componentfilelist=(`bzr ls -q $UCS_FILEPATH/${ARGS[$i]}`)
123+ componentfilelistcount=${#componentfilelist[@]}
124+ if (( componentfilelistcount == 0 )); then
125+ echo -e "${RC}FAILED${NC} (Invalid component name)"
126 else
127- echo -e "Updating ${ARGS[$i]}...${RC}FAILED${NC} (Invalid component name)"
128+ for (( j=0; j<componentfilelistcount; j++ ))
129+ do
130+ filename=$(basename ${componentfilelist[j]})
131+ bzr cat -q ${componentfilelist[j]} > ${PWD}/${filename}
132+ done
133+ echo -e "${GC}DONE${NC}"
134 fi
135 done
136- rm -r $BOOTSTRAP_FOLDER
137 echo -e "${GC}Updating Components Complete!${NC}"
138 else
139- echo -e "${RC}Error updating components! Please specify the component name you want to update. Eg. ./ucs update EmptyState${NC}"
140+ echo -e "${RC}Error updating components! Please specify the component name you want to update. Eg. ucs update EmptyState${NC}"
141 fi
142 fi

Subscribers

People subscribed via source and target branches